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
What is recursion?
What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00
What is vector pair in c++?
What is a storage class?
What is the use of register keyword with the variables?
Why cout is used in c++?
what is oops and list its features in c++?
write asingle linked list which read from two list & the do the following 1 sort the prime & nonprime num (prime should be less tn nonprime) 2 each node has a prime num followd by nonprime 3 add a new node into its sutable plce 4 erase the most three duplicated non prime num 5 find the least duplicated prime num
List the features of oops in c++?
What is prototype in c++ with example?
What does it mean to declare a destructor as static?
What is malloc in c++?
Explain how functions are classified in C++ ?
What is flush programming?
Write a corrected statement in c++ so that the statement will work properly. if (4 < x < 11) y=2*x;