Hello, and thanks for any help in advance!
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:

int counter=0;

int sum=0;

float average=0;

Do I need to use a loop to do this? I have also written the expressions for the three variables:

sum = sum + size;

counter = counter + 1;

average = sum/counter;

I have tried printing the values of counter and average, and I get a negative counter value and a nonense average value.
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!!