Write a program to read 4 numbers and find the maximum, the minimum and average.

Apr 14, 2017 at 11:28am
what i took in class so far:
if-else statement
switch
for loop

is it even possible to do it with those without it being a very long code

Apr 14, 2017 at 12:08pm
Yes it's possible, assuming that you have learned how to read and print numbers. Your code code will need a loop that executes 4 times. Inside the loop, you read one number and add it to a running sum of all numbers so far.

Once the loop exits, compute the average from the sum.
Apr 14, 2017 at 12:18pm
thanks
Topic archived. No new replies allowed.