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
How do you use a 'Local Block'?
What is the purpose of 'register' keyword?
What is the general form of #line preprocessor?
What is a char in c?
Describe explain how arrays can be passed to a user defined function
How do you view the path?
which is an algorithm for sorting in a growing Lexicographic order
Why & is used in c?
How can you find out how much memory is available?
Why is c called a structured programming language?
c program for searching a student details among 10 student details
write a program to find out prime number using sieve case?
Write a program to find factorial of a number using recursive function.
What is wrong with this initialization?
What is void pointers in c?