Write a program that will accept up to 10 integers. The program compares the numbers to determine which is maximum and which one is minimum. At the end the program outputs the minimum number entered and maximum number entered.
The Answer to the Question
is below this banner.
Can't find a solution anywhere?
NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?
Get the Answers Now!You will get a detailed answer to your question or assignment in the shortest time possible.
Here's the Solution to this Question
Solution in C++
#include<iostream.h>
#include<conio.h>
void main(){
int n;
double num;
double max=0.00;
double min=999999.00;
double Maximum(double num,double max);
double Minimum(double num,double min);
cout<<"How many numbers would you like to compare?"<<endl;
cin>>n;
cout<<"Please Enter "<<n<<" numbers"<<endl;
for(int i=0; i < n; i++){
cin>>num;
max = Maximum(num, max);
min = Minimum(num, min);
}
cout<<"The maximum number is "<<max<<endl;
cout<<"The minimum number is " <<min<<endl;
getch();
}
double Maximum(double num, double max){
if(num > max){
max = num;
}
return max;
}
double Minimum(double num, double min){
if(num < min){
min = num;
}
return min;
}