63 140
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #5377 in C++ for Naveed Qurban

Question #5377
Make program that prints minimum and maximum of 10 numbers. Note that you cannot use 10 input variables. You should use loops for the purpose.
Expert's answer

# include<iostream.h>
# include<conio.h>
void main(){
float a[10], min, max;
int i;
for (i=0;i<=9;i++){
& cout<<"Enter a number "<<i+1<<": ";
& cin>>a[i];
}
min = a[0];
max = a[0];
for (i=0;i<=9;i++){
& if (a[i]>max) max = a[i];
& if (a[i]<min) min = a[i];
}
cout<<"Minimum is "<<min<<"\n"<<" Maximum is "<<max;
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions