Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to find the largest and second largest
integer from an array

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does. int *x[](); means ?

1014


Hai what is the different types of versions and their differences

1897


Explain union.

1115


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

1023


Can two or more operators such as and be combined in a single line of program code?

1310


What are the header files used in c language?

995


What is "Duff's Device"?

1114


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2690


I came across some code that puts a (void) cast before each call to printf. Why?

1154


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1898


which is an algorithm for sorting in a growing Lexicographic order

1747


What is a structural principle?

1090


explain what is an endless loop?

1033


What is the use of void pointer and null pointer in c language?

1070


What are the standard predefined macros?

1068