Question
Write a program in C! that asks three students to enter grades they received in their courses and then prints the GPA of each student.
Write a program in C! that asks three students to enter grades they received in their courses and then prints the GPA of each student. A student has taken an indefinite number of courses; they enter the sentinel when they're done entering their grades. The courseshave the same number of credits. The gradescale is(4,3,2,1,0), which corresponds to (A,B,C,D,F), respectively.
Print the GPA as a floating-point value.If the user enters an invalid grade,print an error message and prompt for the same course number again.In the sample below, Student 1 enters -10 for Class 4, the next prompt repeats Class 4.
In this program, it is known that there will be three students and each student has an indefinite number of grades. Whats the suitable loop structure for this program?
Student 1 class 1: 4 class 2: 3 Class 3: 2 Class 4: -10 >>> Invalid grade! Class 4: 1 Class 5: -1 Student 2 Class 1: 3 Class 2: -1 Student 3 class 1 : 3 Class 2: 4 class 3: 12 >>> Invalid grade! class 3: 0 class 4: -1 Student 1 GPA: 2.50 Student 2 GPA: 3.00 Student 3 GPA: 2.33Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started