-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProg65.c
More file actions
43 lines (36 loc) · 872 Bytes
/
Prog65.c
File metadata and controls
43 lines (36 loc) · 872 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
38
39
40
41
42
43
// C-program to input marks of five subjects and calculate percentage and grade according to the question.
#include <stdio.h>
int main()
{
int physics, chemistry, biology, mathematics, computer;
float per;
printf("Enter five subjects marks: ");
scanf("%d%d%d%d%d", &physics, &chemistry, &biology, &mathematics, &computer);
per = (physics + chemistry + biology + mathematics + computer) / 5.0;
printf("Percentage = %.2f\n", per);
if(per >= 90)
{
printf("Grade A");
}
else if(per >= 80)
{
printf("Grade B");
}
else if(per >= 70)
{
printf("Grade C");
}
else if(per >= 60)
{
printf("Grade D");
}
else if(per >= 40)
{
printf("Grade E");
}
else
{
printf("Grade F");
}
return 0;
}