Programming in cloops and decisionspart aexplain the


Programming in C++

Loops and DecisionsPart 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.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Programming in cloops and decisionspart aexplain the
Reference No:- TGS01111628

Expected delivery within 24 Hours