0
Determine highest and lowest number
can someone tell me how to program system to input 10 numbers and the system will determine which is highest number and lowest number using c++.
2 Antworten
+ 1
#include<iostream>
using namespace std;
int main(){
int a[10], max=0, min=9999; //you can change value of max and min, if you want use other values. This program just example
for (int i=0; i<10; i++){
cin>>a[i];
if (a[i]>max) max=a[i];
if (a[i]<min) min=a[i];
}
cout<<"max = "<<max<<"\nmin = "<<min<<endl;
return 0;
}
0
tq for the code