Explanation-c coding and average gpa


Questions:

C Coding and Average GPA

1. My C code cant compile and i cant see the problem can u fix it?

2. write a c code or Modify the code to ask user to input 5 gpas. then the program calculates the average of the gpa and prints it to screen. i.e(The average of all Gpas you entered is 3.87). this code should also check gor negative inputes ie( if user inputs -2.6 or a gpa hight or lower than 1 to 4.0, it print invalisd gpa to the screen.

#include
main ()
/* This C code outputs the equivalent GPA letter grade of a student */
{
float x;
printf("Please enter a GPA value: n");
scanf("%f", &x);
/* An if else statement that sonditions the out of grades*/
if (x < 1.0)
{
Printf("A gpa of %.0f is a grade F: n", x);
}
else if (x >= 1.0 || x < 1.7)
{
Printf("A gpa of %.0f is a grade D: n", x);
}
else if (x >= 1.7 || x < 2.7)
{
printf("A gpa of %.0f is a grade C: n", x);
}
else if (x >= 2.7 || x < 3.5)
{
printf("A gpa of %.0f is a grade B: n", x);
}
else if (x >= 3.5)
{
printf("A gpa of %.0f is a grade A: n", x);
}
return (1);
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Explanation-c coding and average gpa
Reference No:- TGS01936037

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)