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 is structure padding and packing in c?
What is the difference between far and near ?
What is ambagious result in C? explain with an example.
How can you call a function, given its name as a string?
What is the stack in c?
What do you mean by scope of a variable in c?
What does a function declared as pascal do differently?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Can you please explain the difference between malloc() and calloc() function?
Can you apply link and association interchangeably?
What is a static function in c?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
Should I learn data structures in c or python?
Explain the concept and use of type void.