#include<stdio.h> #include<conio.h> void main() { clrscr(); int mark[5], i; float sum=0,average; printf("\n Enter marks obtained in 5 subjects "); for(i=1; i<=5; i++) { printf("\n Subject %d=",i); scanf("%d",&mark[i]); sum=sum+mark[i]; } average=sum/5; printf("\n Your Grade is "); if(average>80) { printf("A"); } else if(average>60 && average<=80) { printf("B"); } else if(average>40 && average<=60) { printf("C"); } else { printf("D"); } getch(); }
Run:Previous Next
No comments:
Post a Comment