Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find the maximum of 10 numbers ?

Answer Posted / ahmed.aboelella

/**
As there is no need to save in array
Also we have to init max with first value to get max in case
user entered negative values
*/

#include "iostream"

using namespace std;

void main()
{
cout<<"Enter 10 numbers: ";

int i, temp, max;

//Enter first number to init max
cin>>max;

for(i = 0 ; i < 9; i ++)
{
cout<<"Enter Number: ";
cin>>temp;
max = temp > max ? temp : max;
}

cout<<"Max Number is "<<max<<endl;

}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between overloading and overriding?

1108


What is heap sort in c++?

1074


What is c++ & why it is used?

1099


What is the basic of c++?

1062


Which programming language should I learn first?

1096


How can I disable the "echo" feature?

1175


Does c++ cost money?

996


Is it possible to provide default values while overloading a binary operator?

1268


What is constant in c++ with example?

1147


Explain the difference between class and struct in c++?

1044


What is the use of pointer in c++ with example?

1047


an operation between an integer and real always yeilds a) integer result b) real result c) float result

1153


Which bit wise operator is suitable for putting on a particular bit in a number?

1213


What is a character in c++?

1045


Why c++ is better than c language?

1020