I want to have a program that finds the sum of a group of numbers. I would like for it to ask how many numbers total there will be, and then ask for the input.
So output like -
How many numbers do you want to input? 4
Input 1:1
Input 2:2.5
Input 3:10
Input 4:3
Sum = 16.5
Average = 4.13
-----
I read that you can use a definite iteration which takes the amount of times specified, and executes the statement that amount of times. So in this case, 4 would be the times specified. I don't know what code I would use to get that to happen though.
Is there a way that I could do it so that so that I could just have it not ask for how many numbers, but just keep asking for a number? And then if they enter 0 it stops asking?
so example output would be:
Please enter a number:5
Please enter the next number: 21
Please enter the next number: 0