write a program to find the largest and second largest
integer from an array
Answers were Sorted based on User's Feedback
Answer / manish gupta
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],x,y,c;
for (x=0;x<5;x++)
{
printf("enter any number");
scanf("%d",&a[x]);
}
for (x=0;x<5;x++)
{
for (y=0;y<4;y++)
{
if (a[y]>a[y+1])
{
c=a[y];
a[y]=a[y+1];
a[y+1]=c;
}
}
}
printf("\nlargest no:-%d",a[y]);
printf("\nsecond largest no:-%d",a[y-1]);
getch();
}
Is This Answer Correct ? | 17 Yes | 8 No |
Answer / mahesh
use bubble sort next to this, print last n second from last..
Is This Answer Correct ? | 1 Yes | 1 No |
What is Lazy evaluation in C? Give an example.
Can we include one C program into another C program if yes how?
Where are some collections of useful code fragments and examples?
What is a good way to implement complex numbers in c?
difference between semaphores and mutex?
#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); }
how to find turn around time in operating system?
hi any body pls give me company name interview conduct "c" language only
i have a written test in tomorrow
Why is c still so popular?
what is the hexidecimal number of 4100?
Tell us the use of fflush() function in c language?