find second largest element in array w/o using sorting
techniques? use onle one for loop.
Answer Posted / k.shravan
main()
{
int a[10],min,max,temp,i;
clrscr();
printf("\n\n Enter the array=>");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
min=max=a[0];
for(i=1;i<5;i++)
{
if(a[i]>max)
{
min=max;
max=a[i];
}
if(a[i]<max && a[i]>min)
{
min=a[i];
}
}
printf("%d---%d",max,min);
getch();
}
| Is This Answer Correct ? | 7 Yes | 11 No |
Post New Answer View All Answers
What is floating point constants?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Which node is more powerful and can handle local information processing or graphics processing?
What is the difference between the = symbol and == symbol?
What is pass by reference in c?
Is there sort function in c?
Write a program to print “hello world” without using semicolon?
Why is c so important?
What do you mean by scope of a variable in c?
Explain a file operation in C with an example.
what do you mean by inline function in C?
What are type modifiers in c?
What are data types in c language?
What is the default value of local and global variables in c?
how to build a exercise findig min number of e heap with list imlemented?