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
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
What is the process to create increment and decrement stamen in c?
Why C language is a procedural language?
What should malloc() do?
Write a program with dynamically allocation of variable.
Differentiate between #include<...> and #include '...'
What are different types of operators?
Explain what is wrong with this program statement?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
How many levels deep can include files be nested?
What does nil mean in c?
Why clrscr is used after variable declaration?
Give basis knowledge of web designing ...
Explain how can a program be made to print the name of a source file where an error occurs?
explain what is an endless loop?