#include <stdio.h>
int main(void) {
int Physics,Chemistry,Biology,Mathematics,Computer;
float percentage;
printf("Enter mark of Physics subject: ");
scanf("%d",&Physics);
printf("Enter mark of Chemistry subject: ");
scanf("%d",&Chemistry);
printf("Enter mark of Biology subject: ");
scanf("%d",&Biology);
printf("Enter mark of Mathematics subject: ");
scanf("%d",&Mathematics);
printf("Enter mark of Computer subject: ");
scanf("%d",&Computer);
percentage=((Physics+Chemistry+Biology+Mathematics+Computer)/5.0);
printf("\nPercentage: %.2f\n",percentage);
if(percentage>100){
printf("Invalid marks assigned");
}else if(percentage>=90 && percentage<=100){
printf("Grade: A\n");
}else if(percentage>=80 && percentage<90){
printf("Grade: B\n");
}else if(percentage>=70 && percentage<80){
printf("Grade: C\n");
}else if(percentage>=60 && percentage<70){
printf("Grade: D\n");
}else if(percentage>=40 && percentage<60){
printf("Grade: E\n");
}else{
printf("Grade: F\n");
}
getchar();
getchar();
return 0;
}
Comments
Leave a comment