find second largest element in array w/o using sorting
techniques? use onle one for loop.
Answer Posted / anamika datta
#include<stdio.h>
#include<conio.h>
void main()
{
int n[]={5,3,4};
int i,large,sec_large;
clrscr();
large=sec_large=n[0];
for(i=0;i<3;i++)
{
if(n[i]>large)
{
sec_large=large;
large=n[i];
}
}
printf("%d",sec_large);
}
getch();
| Is This Answer Correct ? | 10 Yes | 19 No |
Post New Answer View All Answers
What are enums in c?
What is meant by 'bit masking'?
What is indirection?
why wipro wase
how to build a exercise findig min number of e heap with list imlemented?
What does volatile do?
What is meant by high-order and low-order bytes?
Why is this loop always executing once?
how to introdu5ce my self in serco
What are different storage class specifiers in c?
What do you understand by normalization of pointers?
What is the purpose of sprintf?
What is a scope resolution operator in c?
Why do we use namespace feature?
Are the variables argc and argv are local to main?