-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResultMechanism.c
63 lines (52 loc) · 1.87 KB
/
ResultMechanism.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <stdio.h>
int main()
{
int z, s1, s2, s3, f1, f2, f3, a, b, c;
printf("The subject-wise full marks respectively are : \n");
scanf("%d%d%d", &f1, &f2, &f3);
printf("Enter your marks for the first subject : ");
scanf("%d", &a);
printf("Enter your marks for the second subject : ");
scanf("%d", &b);
printf("Enter your marks for the third subject : ");
scanf("%d", &c);
s1 = a * 100 / f1;
s2 = b * 100 / f2;
s3 = c * 100 / f3;
z = (a + b + c) * 100 / (f1 + f2 + f3);
while (a > f1 || b > f2 || c > f3 || f1 <= 0 || f2 <= 0 || f3 <= 0)
{
printf("You have entered impossible numbers\n");
printf("Enter the correct marks in each subject again\n");
printf("The subject-wise full marks respectively are : \n");
scanf("%d%d%d", &f1, &f2, &f3);
printf("Enter your marks for the first subject : ");
scanf("%d", &a);
printf("Enter your marks for the second subject : ");
scanf("%d", &b);
printf("Enter your marks for the third subject : ");
scanf("%d", &c);
}
if (s1 >= 33 && s2 >= 33 && s3 >= 33 && z >= 40)
{
printf("You have passed the exam\n");
printf("You have scored %d on cumulative\n", z);
}
else if (s1 < 33 && s2 >= 33 && s3 >= 33 && z >= 40)
{
printf("You have failed in your first subject exam, better luck next time lol\n");
}
else if (s1 >= 33 && s2 < 33 && s3 >= 33 && z >= 40)
{
printf("You have failed in your second subject exam, better luck next time lol\n");
}
else if (s1 >= 33 && s2 >= 33 && s3 < 33 && z >= 40)
{
printf("You have failed in your third subject exam, better luck next time lol\n");
}
else if (s1 >= 33 && s2 >= 33 && s3 >= 33 && z < 40)
{
printf("You have failed in overall performance, hard luck\n");
}
return 0;
}