Write a program that read 2o numbers in and array and
output the second largest number. Can anybody help??

Answer Posted / fahad

#include<iostream.h>
void main()
{
int a[20];
int i;
for(i=o ; i<20 ;i++)
cin>>a[i];
}
int(max=a[0];
for(i=1; i<20; i++)
{
if(a[i]>max) max=a[i];
}
cout<<"\n maimun number is ="<< max<<"\n";
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a vector c++?

555


Who made c++?

613


Define a nested class. Explain how it can be useful.

632


Will c++ be replaced?

554


What is vector string in c++?

576






What is class invariant in c++?

746


Which bitwise operator is used to check whether a particular bit is on or off?

591


Difference between a homogeneous and a heterogeneous container

661


What does #define mean in c++?

615


Can I uninstall microsoft c++ redistributable?

609


what is a class? Explain with an example.

621


What is polymorphism & list its types in c++?

623


What kind of jobs can I get with c++?

599


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

794


What is the function of I/O library in C++ ?

666