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 that read 2o numbers in and array and
output the second largest number. Can anybody help??

Answer Posted / sujeet pardeshi

int k;
for(i=0;i<2;i++)
{
max=0;
for(j=n;j>=i;j--)
{
if(a[j]>max)
{
max=a[j];
k=j;
}
}
swap(a[i],a[k]);
}
printf("2nd highest no is:%d",max);

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between using macro and inline functions?

1144


How is data hiding achieved in c++?

1106


What is the use of endl in c++?

1027


How can I learn c++ easily?

1097


What is the basic structure of c++ program?

1117


What is the purpose of extern storage specifier?

1203


What is a constructor and how is it called?

1059


Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

1125


Why do we use vector in c++?

1088


Can recursive program be written in C++?

1248


Which programming language is best to learn first?

1084


Eplain extern keyword?

1038


What is the difference between public, private, and protected access?

1082


How can you tell what shell you are running on unix system?

1130


What is lvalue?

1187