Basically, as the title says, I am looking for a way to print the number of times the user gave the program an input, and then also print the average of all the inputs.
So far, I have initialized three variables as follows:
Expand|Select|Wrap|Line Numbers
- int counter=0;
- int sum=0;
- float average=0;
Expand|Select|Wrap|Line Numbers
- sum = sum + size;
- counter = counter + 1;
- average = sum/counter;
So, in summary, do I need a loop to print the number of inputs and their average? Also, using a loop or not, how do I get the second three lines of code to work correctly?
Thank you in advance for any help!!