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 |
without using control structures and control structures find the max and min of given 2 nos
What is a class c rental property?
What is a Genralised LInked List?? Please give a detailed explation of it..
int i; i=2; i++; if(i=4) { printf(i=4); } else { printf(i=3); } output of the program ?
x=y=z=1 z=++x||++y&&++z Printf("%%%d";xyz) what is the values of x,y and z?????
wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }
What is main return c?
Can a variable be both constant and volatile?
which type of aspect you want from the student.
What is the use of a conditional inclusion statement in C?
How to implement variable argument functions ?
what is the flow of execution in cprogram? ex:printf();,scanf();