#include<stdio.h> #include<conio.h> void main() { clrscr(); int mark[5], i; float sum=0,avg; printf("Enter marks obtained in 5 subjects :"); for(i=0; i<5; i++) { scanf("%d",&mark[i]); sum=sum+mark[i]; } avg=sum/5; printf("Your Grade is "); if(avg>80) { printf("A"); } else if(avg>60 && avg<=80) { printf("B"); } else if(avg>40 && avg<=60) { printf("C"); } else { printf("D"); } getch(); }
C program to calculate student grades.
Reviewed by
on
December 22, 2019
Rating:
No comments: