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

Differentiate between a constructor and a destructor in c++.

653


How can virtual functions in c++ be implemented?

698


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

682


What does floor mean in c++?

673


Can we specify variable field width in a scanf() format string? If possible how?

755






Why do we use iterators?

720


What flag means?

602


When do you call copy constructors?

763


Is atoi safe?

703


Why is main an int?

620


Is C++ case sensitive a) False b) Depends on implementation c) True

695


What is a memory leak c++?

668


Define token in c++.

810


Why is c++ still best?

645


Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list

707