adspace


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

daily Routine of father

1492


What is the latest version on c++?

1217


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1172


What character terminates all character array strings a) b) . c) END

1403


Can union be self referenced?

1279