0% found this document useful (0 votes)
10 views4 pages

Find Highest and Lowest Numbers

The program takes 5 random numbers as input and finds the highest and lowest numbers. It uses if/else statements to compare the numbers and output the highest and lowest values.

Uploaded by

Elise Palicte
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Find Highest and Lowest Numbers

The program takes 5 random numbers as input and finds the highest and lowest numbers. It uses if/else statements to compare the numbers and output the highest and lowest values.

Uploaded by

Elise Palicte
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Input 5 random numbers and find the highest and lowest number and make a program

#include <iostream>

using namespace std;

int main()

int num6, num7, num8, num9, num10;


cout<<"Input 5 random numbers: ";

cin>>num6;

cin>>num7;

cin>>num8;

cin>>num9;

cin>>num10;

if(num6>num7 && num6>num8 && num6>num9 && num6>num10)

cout<<"Highest: "<<num6;

else if(num7>num6 && num7>num8 && num7>num9 && num7>num10)

cout<<"Highest: "<<num7;

else if(num8>num6 && num8>num7 && num8>num9 && num8>num10)

cout<<"Highest: "<<num8;

else if(num9>num6 && num9>num7 && num9>num8 && num9>num10)


{

cout<<"Highest: "<<num9;

else if(num10>num6 && num10>num7 && num10>num8 && num10>num9)

cout<<"Highest: "<<num10;

if(num6<num7 && num6<num8 && num6<num9 && num6<num10)

cout<<"\nLowest: "<<num6;

else if(num7<num6 && num7<num8 && num7<num9 && num7<num10)

cout<<"\nLowest: "<<num7;

else if(num8<num6 && num8<num7 && num8<num9 && num8<num10)

cout<<"\nLowest: "<<num8;

}
else if(num9<num6 && num9<num7 && num9<num8 && num9<num10)

cout<<"\nLowest: "<<num9;

else if(num10<num6 && num10<num7 && num10<num8 && num10<num9)

cout<<"\nLowest: "<<num10;

return 0;

You might also like