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 |
how can we print hellow world programme without using semicolon
what is the basis for selection of arrays or pointers as data structure in a program
What are the 4 types of functions?
program to get the remainder and quotant of given two numbers with out using % and / operators?
10 Answers College School Exams Tests, IBM,
What is the explanation for modular programming?
write a c program in such a way that if we enter the today date the output should be next day's date.
What is the use of function overloading in C?
Write a program in c to print * * * * * *******
Explain following declaration int *P(void); and int (*p)(char *a);
what is pointer ?
10 Answers Kernex Micro Systems,
IS it possible to define a zero sized array in c.if it is possible how can the elements of that array can be accessed.array index starts from zero,if it is possible to define zero sized array how can be its first element can be accesseed.
write C code to reverse a string such that if i/p is "abc defg hij klmno pqrs tuv wxyz" and the o/p should be "cba gfed jih onmlk srqp vut zyxw"