Skip to main content
Logo image

Section 6.4 Averages

At this point, we have already learned all the tools needed to calculate the average of a set of numbers!

Activity 6.3.

Write a C program that finds the average of integers, entered by the user. First, the user should be asked to enter the number of integers they wish to average, then they should be asked to enter those integers and their average should be calculated.
Here is a sample run of your program (with simulated user input):
How many integers do you wish to average? 3
Please enter an integer: 8
Please enter an integer: 12
Please enter an integer: 101
The average is 40.333333.
Recall that the average needs to be of type float, please store it in the variable ave which has already been declared for your convenience.

admin.....open in new window

When you are done, please paste your code into the box below: