Professional Documents
Culture Documents
1. Write a program to calculate the average of n numbers, and then compute the deviation
of each number about the average
Sample output:
How many numbers will be average? 5
i=1 x=3
i=1 x = -2
i=1 x = 12
i=1 x = 4.4
i=1 x = 3.5
2.Write a short program that prints the number of days per month.
Sample output:
3.Suppose we took a telephone survey to discover how people felt about a particular
television show and we asked each respondent to rate the show on a scale from 1 to 10,
inclusive .One of the first pieces of data we would like to gather is a table showing the
distribution of the ratings. In other words, we would like to know how many people rated
the show a1, how many a 2 and so on up to 10.Write the program for the survey as well.
Sample output:
Enter your response
6
5
8
3
9
6
5
7
15
Bad response: 15
5
5
1
7
4
10
5
5
6
8
9
6
1 1
2 0
3 1
4 1
5 6
6 4
7 2
8 2
9 2
10 1