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 |
Q.11 Generate the following pattern using code in any language(c/c++/java) for n no. of rows 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
void main() {int i=2; printf("%d%d%d",i,++i,i++); getch(); }
write a c program for greatest of three numbers without using if statment
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
5 Answers Vector, Vector Solutions,
write c program to display output 10(10+20)+(10+20+30)+ ... n term
0 Answers Hindustan Gum Chemicals,
What does %f mean c?
#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9; int z=(c=x+y)*2; printf("%h %h %h",x,y,z); } What is the output? Explain it.
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 disadvantage of pointer in C
What's a "sequence point"?
who is the father of C Language?
20 Answers CTS, UST,