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 / ajit

#include<stdio.h>
void main()
{
int a[20],i,j,temp;
printf("enter the 20 values\n");
for(i=0;i<20;i++)
scanf("%d",&a[i]);
for(i=0;i<20;i++)
{
for(j=i+1;j<20;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("the second largest number is %d\n",a[18]);
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a dll entry point?

949


What is c++ map?

1053


Does dev c++ support c++ 11?

967


What is function prototyping?

1046


What is the role of copy constructor in copying of thrown objects?

1007


Is c++ fully object oriented?

921


What is the difference between the indirection operator and the address of oper-ator?

1059


Describe protected access specifiers?

1147


How can you link a c++ program to c functions?

1063


What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

1053


write a programme to get a character and thier ASCII value

2998


What is jump statement in C++?

1058


What is a forward referencing and when should it be used?

1104


Write a program to interchange 2 variables without using the third one.

1007


What is else syntax in c++?

1123