About Lesson
Develop a program that takes a student’s percentage as input and assigns a grade based on the following criteria:
90% and above: A
80% to 89%: B
70% to 79%: C
60% to 69%: D
Below 60%: F
#include <stdio.h>
int main() {
// Declare variables
float percentage;// Input: Get the percentage from the user
printf(“Enter the student’s percentage: “);
scanf(“%f”, &percentage);// Process: Assign grade based on percentage
if (percentage >= 90) {
printf(“Grade: An”);
} else if (percentage >= 80) {
printf(“Grade: Bn”);
} else if (percentage >= 70) {
printf(“Grade: Cn”);
} else if (percentage >= 60) {
printf(“Grade: Dn”);
} else {
printf(“Grade: Fn”);
}return 0; // Exit the program successfully
}