Determine highest and lowest number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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++.

24th Sep 2017, 10:02 AM
Akmal Firdaus
Akmal Firdaus - avatar
2 Answers
+ 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; }
24th Sep 2017, 11:14 AM
Aleksey Beliy
Aleksey Beliy - avatar
0
tq for the code
25th Sep 2017, 4:24 PM
Akmal Firdaus
Akmal Firdaus - avatar