-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path5_1.c
More file actions
executable file
·37 lines (37 loc) · 844 Bytes
/
5_1.c
File metadata and controls
executable file
·37 lines (37 loc) · 844 Bytes
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
//5.1 -To calculate grade
#include<stdio.h>
int main()
{
int i;
float mark, sum=0, avg;
printf("Enter Marks obtained in 5 Subjects: ");
for(i=0; i<5; i++)
{
scanf("%f", &mark);
sum = sum+mark;
}
avg = sum/5;
printf ("percentage :- %.2f",avg);
printf("\nGrade = ");
if(avg>=91 && avg<=100)
printf("A1");
else if(avg>=81 && avg<91)
printf("A2");
else if(avg>=71 && avg<81)
printf("B1");
else if(avg>=61 && avg<71)
printf("B2");
else if(avg>=51 && avg<61)
printf("C1");
else if(avg>=41 && avg<51)
printf("C2");
else if(avg>=33 && avg<41)
printf("D");
else if(avg>=21 && avg<33)
printf("E1");
else if(avg>=0 && avg<21)
printf("E2");
else
printf("Invalid entry!");
return 0;
}