Input 5 numbers and display the highest and lowest number. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Input 5 numbers and display the highest and lowest number.

Using one dimensional array

14th Apr 2017, 4:05 AM
Jeza Tuazon
Jeza Tuazon - avatar
2 Answers
+ 9
Create an array, collect 5 numbers into that array, sort the array from highest to lowest, use a for loop to start from 0 and go to n where n is the size of the array, and have it print what it finds at the index.
14th Apr 2017, 4:17 AM
SoraKatadzuma
SoraKatadzuma - avatar
14th Apr 2017, 12:53 PM
Tamás Barta
Tamás Barta - avatar