# Answer to Question #16856 in C++ for momen said

Question #16856

You Will take 10 numbers from the User and you will get the Max and the Min (in while)

Expert's answer

#include<iostream.h>

int a[10];

int i, max, min;

void main(){

i = 0;

while (i<11){

& cout<<"enter a number: ";

& cin>>a[i];

& if (i==0) max = min = a[0];

& if (max<a[i]) max=a[i];

& if (min>a[i]) min=a[i];

& i++;

}

cout<<"maximum: "<<max<<"\nminimum: "<<min<<"\n";

}

int a[10];

int i, max, min;

void main(){

i = 0;

while (i<11){

& cout<<"enter a number: ";

& cin>>a[i];

& if (i==0) max = min = a[0];

& if (max<a[i]) max=a[i];

& if (min>a[i]) min=a[i];

& i++;

}

cout<<"maximum: "<<max<<"\nminimum: "<<min<<"\n";

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment