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
Can you please explain the difference between overloading and overriding?
What is heap sort in c++?
What is c++ & why it is used?
What is the basic of c++?
Which programming language should I learn first?
How can I disable the "echo" feature?
Does c++ cost money?
Is it possible to provide default values while overloading a binary operator?
What is constant in c++ with example?
Explain the difference between class and struct in c++?
What is the use of pointer in c++ with example?
an operation between an integer and real always yeilds a) integer result b) real result c) float result
Which bit wise operator is suitable for putting on a particular bit in a number?
What is a character in c++?
Why c++ is better than c language?