-
Notifications
You must be signed in to change notification settings - Fork 0
/
marks.c
42 lines (42 loc) · 1.01 KB
/
marks.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<stdio.h>
#include<stdlib.h>
int main()
{
int marks1,marks2,marks3,marks4,marks5;
float percentage;
char grade;
printf("Enter marks of your subjects\n");
scanf("%d %d %d %d %d",&marks1,&marks2,&marks3,&marks4,&marks5);
percentage=(marks1+marks2+marks3+marks4+marks5)/5;
printf("Percentage is %f",percentage);
if(percentage>90 && percentage<=100)
{
grade='A+';
printf("Grade is %c",grade);
}
else if(percentage>80 && percentage<=90)
{
grade='A';
printf("Grade is %c",grade);
}
else if(percentage>70 && percentage<=80)
{
grade='B';
printf("Grade is %c",grade);
}
else if(percentage>60 && percentage<=70)
{
grade='C';
printf("Grade is %c",grade);
}
else if(percentage>50 && percentage<=60)
{
grade='D';
printf("Grade is %c",grade);
}
else
{
printf("Sorry!Can't display marks");
}
return 0;
}