The question asks to write a program that calculates GPA withthe final version looking like- What am I doing wrong?
char grade;
int TotalPoints,TotalCredit,count=0;
printf(“My name is: Joel Duben”); // Prints name
do
{
printf(“Enter a grade to continue or any other value to quit:”);
scanf(“%c”,&grade);
if (grade==’A’ || grade==’B’ || grade==’C’ || grade==’D’ ||grade==’a’ || grade==’b’ || grade==’c’ || grade==’d’)
{
printf(“Enter the number of credit hours: “);
scanf(“%d”,&TotalCredit);
TotalPoints+=TotalCredit;
count++;
scanf(“%c”,&grade);
}
else
break;
}
while (1);
{
printf(“The total number of credit hours is: %d and GPA is%fn”,TotalPoints,(float) TotalCredit);
}
getch();
return 0;
My name is: Ima Goodstudent Enter a grade to continue or any other value to quit: Enter the number of credit hours: Enter a grade to continue or any other value to quit: Enter the number of credit hours: Enter a grade to cont inue or any other value to quit: Enter the number of credit hours: 2 Enter a grade to cont inue or any other value to quit: 9 and the GPA is: 3.000 The total number of credit hours is: Show transcribed image text My name is: Ima Goodstudent Enter a grade to continue or any other value to quit: Enter the number of credit hours: Enter a grade to continue or any other value to quit: Enter the number of credit hours: Enter a grade to cont inue or any other value to quit: Enter the number of credit hours: 2 Enter a grade to cont inue or any other value to quit: 9 and the GPA is: 3.000 The total number of credit hours is:
Expert Answer
Answer to The question asks to write a program that calculates GPA with the final version looking like- What am I doing wrong? cha…