How to find the largest and the smallest number? whereby ,user need to enter how many number he/she want ,using for loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find the largest and the smallest number? whereby ,user need to enter how many number he/she want ,using for loop

10th Nov 2017, 1:42 AM
Muhammad Amin Bin Mohd Hafendi
Muhammad Amin Bin Mohd Hafendi - avatar
3 Answers
+ 1
what did you get so far? hints: std::sort and with c++17 min_element and max_element http://en.cppreference.com/w/cpp/algorithm/min_element
10th Nov 2017, 2:08 AM
Gunther Strauss
Gunther Strauss - avatar
+ 1
cin>>int a; int q; int max; for (int i=0;i<a;i++){ cin>>q; if (q>max){max=q;} } cout<<max;
10th Nov 2017, 2:36 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
thanks a lot 🔥
10th Nov 2017, 2:40 AM
Muhammad Amin Bin Mohd Hafendi
Muhammad Amin Bin Mohd Hafendi - avatar