Skill set for this assignment:
Example:
Input: 44.76 -67 87.5 0 12 86.89 90
Output: The average Celsius temperature is 2.392857
Problem 2
(20 points):
Write a program that inputs a series of non-negative integers between
0
and 100. Each integer indicates the student's grade. The first negative
value will terminate the input. The program outputs the letter equivalent
for each numeric grade according to the following table:
A: 100 - 90
B: 89 - 75
C: 74 - 65
D: 64 - 60
F: 59 - 0
You can assume that the input is a valid sequence of integers between
0
and 100. You can assume that the input is not empty - there is at least
one non-negative integer in the input sequence before the negative number
that terminates the input. You don't need to check the validity of the
input.
Example 1:
Input: 63, 75, 100, 0, 74, 86, 98, 75, -9
Output: D, B, A, F, C, B, A, B
Example 2:
Input: 75, -8
Output: B
Problem 3
(10 points):
Write a C program that prompts its user for a nonnegative
value n. The program then displays as its output:
Program 4 (20 points)
Write a program that reads one integer that indicates the
numeric
value of the month and one integer that indicates the year. Your program
will print the amount of days in the month that was entered. For example,
if the input was 5 ( May) the program will output 30 days, if the input
was 12 ( December), the program will output 31 days, if the input is 2 (
February), the program will check the year and find out if the amount of
days is equal 28 or 29 (the algorithm for calculating a leap year is as
follows: A year will be a leap year if it is divisible by 4 but not by
100. If a year is divisible by 4 and by 100, it is not a leap year unless
it is also divisible by 400. Thus years such as 1996, 1992, 1988 and so on
are leap years because they are divisible by 4 but not by 100. For century
years, the 400 rule is important. Thus, century years 1900, 1800 and 1700
while all still divisible by 4 are also exactly divisible by 100. As they
are not further divisible by 400, they are not leap years), if the input
is less or equal 0 or greater than 12, the program will print the message
"Invalid month".
You have to use SWITCH statement in this problem
Problem 5 (10 points)
There is a treasure box with 1 million dollars. The chest has a
3-digit
combination lock that opens under the following conditions: the first
digit should be equal to the last digit, the second digit should be even, and the sum of all
digits should be divisible by 4. Write a program that reads a series of non-negative integers
between 100 and 999. The first negative value will terminate the input.
For
each input, the program checks if
the number opens the chest or not. For each input, the output should be
YES,
if the chest opens,
and NO otherwise.
Example:
525 425 515 505 -1
Output:
YES NO NO NO
Problem 6 (20
points)
Write a
program which will find and display ALL four-digit positive
integers that are divisible by the sum of their digits.
For example, number 1100 is divisible by sum of its digits.
Write a C program that reads in a number N and prints out all those numbers between 1 and N that are perfect numbers. For example, if the prompted input was 30, the program would print out 6 and 28. Your program should be able to accept values of N up to 10000.
The program has to check a validity for the input.
A few remarks and helpful hints:
For example, if the input is 13, the output should be
2, 3, 5, 7, 11, 13
For example, if the input number is 21, the output should be
2, 3, 5, 7, 11, 13, 17, 19