Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of the given program, determine if these is an error in the code, if th

ID: 3830380 • Letter: F

Question

For each of the given program, determine if these is an error in the code, if there is an error whether it is logic on complaining error, click the error in the program and the in the provide after cash problem. If the code does not contain in error, write The following program segment should calculate of a student has a passing grade. If the code should Otherwise the code should and you must take this course again. The following program segment should input 15 from the user and calculate their total. The following program segment should input and sun integers from the user until the value, -1 is entered.

Explanation / Answer

35.
corrected code

if(grade >= 60)
{
   cout << "Passed ";
}
// else statement should contain brackets and include both statements
else
{
   cout << "Failed ";
   cout << "You must take the course again ";
}

36.
corrected code

int total = 0;
int counter = 0; // conter should start from zero
int input;

while(total <= 15)
{
   cin >> input;
   total = total + input;
   counter++;
}

37.
corrected code

// one input shoudl be taken outside the whiel loop
// to chec the sentinal condition

int total = 0;
int input;

cin >> input;
while(input != -1)
{
   cin >> input;
   total += input;
}