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

I need a solution for project 4 which is a continuation for project 3 and I can

ID: 3851617 • Letter: I

Question

I need a solution for project 4 which is a continuation for project 3 and I can only use if else statement or while so please don't use any case statements and there is also some of the lecture notes that might be helpful and the code for project 3 is attached as well.

23 24 25 26 27 28 29 30 // loop while sentinel value not yet read from user while ( grade != -1 ) { total = total + grade; // add grade to total counter = counter + 1; // increment counter // get next grade from user printf( "%s'. "Enter grade. scanf("%d". &grade;); // read // prompt for input next grade )/end while 32 // termination phase // if user entered at least one grade 35 if counter0) 36 37 38 39 40 calculate average of al1 grades entered average = ( float ) total / counter; // avoid truncation // display average with two digits of precision printf( "Class average is 2mn, end if n", average 42 43 else // if no grades were entered, output message puts( "No grades were entered" 45 46 )end else // end function main

Explanation / Answer

Answer for Question Part 3:

See the below code is having the while case with y/Y or n/N for no operation.

#include<stdio.h>
#include<conio.h>

int main()
{
int choice, a, b;
int sum, div, mul, sub;
char c= 'y';

while(c=='y' || c=='Y')
{
printf(" Addition -> 1 Subtraction -> 2 Multiplication -> 3 Division -> 4 ");
printf("Enter your choice of operation to perform -: ");
scanf("%d",& choice);
printf(" Enter two number :- ");
scanf("%d%d",&a,&b);
switch(choice)
{

case 1: sum = a + b;
printf(" Sum = %d", sum);
break;

case 2: sub = a - b;
printf(" Difference = %d", sub);
break;

case 3: mul = a * b;
printf(" Multiplication = %d", mul);
break;

case 4: div = a - b;
printf(" Division = %d", div);
break;

default : printf("WRONG CHOICE");
}
printf(" Do you want to continue [y / n]");
c=getch();
}
getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote