M Ford wrote:sorry but as you can gather i am a complete novice at this... can you show me the syntax for that?
You already have a loop that gathers the total of the numbers entered. The average of them is not the total divided by any of the values, but the total divided by the number of entries. In other words, if the user enters 5 values, it is the total divided by 5. So declare another integer variable outside the loop, set to 0. Each time through the loop, add one to it (count = count + 1). After the loop is done, divide the total by the number of entries to get your average. Or you can do the division after each of the entries, for the average "up to that point".
I understand how to get the average. I've tried different ways to add how many times an integer is entered so I can divide the total by that but I just cant seem to figure it out. Tried creating another integer outside the loop but which ever way I do it, instead of adding how many times the integers are being added, it just adds the value for them instead.
I moved the calculation of the average to outside the loop. This doesn't make much difference, but you may as well do things within the loop that depend on being in the loop, and other things outside it. Someone might wonder why you calculate the average every time through the loop, since you don't use it there.
Since your average value is an integer, you will only have an integer value for the average, and I think integer division will truncate (throw away any fractional portion) instead of rounding. If you wanted fractional values, you could use a float for average, or you could call a rounding function on your integer calculation if you wanted to do it that way.