C program for percentage of student then it calculate and display his grade using simple if structure
rather than if else.
Answers
Answered by
1
Answer:
# include <stdio.h>
int main (void){
float math, physics, chemistry, percent;
printf("Enter your marks in maths");
scanf("%f", &math);
printf("Enter your marks in physics");
scanf("%f", &physics);
printf("Enter your marks in chemistry");
scanf("%f", &chemistry);
percent = (math + physics + chemistry) / 3;
if (percent >= 90)
printf("Congratulations you have got A grade\n");
if (percent >= 70 && percent < 90)
printf("Congratulations you have got B grade\n");
if (percent >=50 && percent < 70)
printf("Congratulations you have got C grade\n");
if (percent < 50)
printf("Sorry you have got D grade\n");
return 0;
}
Similar questions