Write a program that accepts four grades calculates the


Part A

Explain the difference between:

s = 0;
If (x > 0) s++;
If (y > 0) s++;

and

s = 0;
if (x > 0) s++;
else if (y > 0) s++;

Part B

What are the values of s and n after the following loops?:

a. int s = 1;
int n = 1;
while (x < 10)
s = s + n;
n++;

b. int s = 1;
int n;
for (n = 1; n < 5; n++)
s = s + n;

c. int s = 1;
int n = 1;
do
{
s = s + n;
n++;
}
while (s < 10 * n);

Part C

Write a program that accepts four grades, calculates the average of the four grades, and then converts the average from a number grade into a letter grading using the following grading scale:

A 100 - 90
B 89 - 80
C 79 - 70
D 69 - 60
F 59 - 0

Output the final grade average along with the letter grade.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a program that accepts four grades calculates the
Reference No:- TGS01275862

Now Priced at $40 (50% Discount)

Recommended (90%)

Rated (4.3/5)