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 time complexity c?
Write a program in C to convert date displayed in gregorian to julian date
a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
i want to know the procedure of qualcomm for getting a job through offcampus
main() { int i; printf("%d",i^i); }
Write a program which returns the first non repetitive character in the string?
struct ptr { int a; char b; int *p; }abc; what is d sizeof structure without using "sizeof" operator??
Why we use break in c?
What is alloca() and why is its use discouraged?
Explain how can a program be made to print the line number where an error occurs?
What is optimization in c?