-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01problem.c
More file actions
51 lines (43 loc) · 1.16 KB
/
01problem.c
File metadata and controls
51 lines (43 loc) · 1.16 KB
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
44
45
46
47
48
49
50
51
#include <stdio.h>
int main()
{
int marks1, marks2, marks3;
float average;
// marks input
printf("Enter marks1:");
scanf("%d", &marks1);
printf("Enter marks2:\n");
scanf("%d", &marks2);
printf("Enter marks3:\n");
scanf("%d", &marks3);
// average calculation
average = (marks1 + marks2 + marks3) / 3.0;
printf("The average is %.2f\n", (marks1 + marks2 + marks3) / 3);
// applying average and printing grades
if (average > 33 && average < 55)
{
printf("Congratulations ! you are passed\n");
printf("Your grade is D");
}
else if (average > 55 && average < 60)
{
printf("Congratulations ! you are passed\n");
printf("Your grade is C");
}
else if (average > 55 && average < 60)
{
printf("Congratulations ! you are passed\n");
printf("Your grade is B");
}
else if (average > 90 && average < 100)
{
printf("Congratulations ! you are passed\n");
printf("Your grade is A");
}
else if (average < 33)
{
printf("Unfortunately! you are failed bro\n");
printf("Your grade is E");
}
return 0;
}