-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc_program_practise16.txt
57 lines (56 loc) · 1.09 KB
/
c_program_practise16.txt
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
#include <stdio.h>
int main()
{
float x[100];
float total;
int n;
printf("Enter the number of subjects: ");
scanf("%d",&n);
printf("Enter the marks:\n");
for (int i=1;i<=n;i++)
{
scanf("%f",&x[i]);
}
for (int i=1;i<=n;i++)
{
printf("%.2f\n",x[i]);
}
for (int i=1;i<=n;i++)
{
total = total+x[i];
}
printf("The total marks is %.2f\n",total);
float average=total/n;
if(average>90 && average<=100)
{
printf("A");
}
else if(average>80 && average<=90)
{
printf("B");
}
else if(average>70 && average<=80)
{
printf("C");
}
else if(average>60 && average<=70)
{
printf("D");
}
else if(average>50 && average<=60)
{
printf("E");
}
else if(average>40 && average<=50)
{
printf("F");
}
else if(average<=40)
{
printf("FAIL - Failure is the stepping stone to success");
}
else
{
printf("Invalid credential entered");
}
}