#include <stdio.h>
main()
{
int number_of_numbers, count = 1;
float takeinput, average, total = 0;
printf("\n\nHow many numbers will you type in ? : ");
scanf("%d", &number_of_numbers);
do
{
printf("Enter a number: ");
scanf("%f", &takeinput);
total = total + takeinput;
count = count + 1;
}
while (count <= number_of_numbers);
average = total/number_of_numbers;
printf("\nThe average of all these numbers is: %.2f", average);
printf("\n\n");
}
Execution
How many numbers will you type in ? : 10
Enter a number: 59
Enter a number: 21
Enter a number: 69
Enter a number: 93
Enter a number: 27
Enter a number: 83
Enter a number: 54
Enter a number: 59
Enter a number: 71
Enter a number: 82
The average of all these numbers is: 61.80
Software outsourcing in Eastern Europe is quite beneficial in terms of an attractive cost-to-quality ratio. Geographically all these countries are in a close proximity to each other and Western Europe. But still they have a range of differences. Learn more about best country for web developers.
ReplyDelete