Nothing Special   »   [go: up one dir, main page]

Input 5 Random Numbers and Find The Highest and Lowest Number and Make A Program

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

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