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 far pointer? where we use it?

621


What can I safely assume about the initial values of variables which are not explicitly initialized?

627


What is the main purpose of c++?

551


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

576


What is c++ used for in games?

609






Explain rethrowing exceptions with an example?

612


What is an undefined reference/unresolved external symbol error and how do I fix it?

609


What are the rules about using an underscore in a c++ identifier?

636


How do you establish an is-a relationship?

625


Define a conversion constructor?

626


find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

2004


Explain the use of vtable.

622


What is the use of "new" operator?

662


Are c and c++ similar?

592


What's c++ used for?

602