-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathq1_imp.c
123 lines (121 loc) · 2.28 KB
/
q1_imp.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include<stdio.h>
void main()
{
int a[3],b[3],c[3];
///////
printf("enter the marks for three rounds for A\n");
for(int i=0;i<3;i++)
{
scanf("%d",&a[i]);
}
printf("enter the marks for three rounds for B\n");
for(int i=0;i<3;i++)
{
scanf("%d",&b[i]);
}
printf("enter the marks for three rounds for C\n");
for(int i=0;i<3;i++)
{
scanf("%d",&c[i]);
}
////////
printf("marks of A for three rounds are ");
for(int i=0;i<3;i++)
{
printf(" %d ",a[i]);
}
printf("\nmarks of B for three rounds are ");
for(int i=0;i<3;i++)
{
printf(" %d ",b[i]);
}
printf("\nmarks of c for three rounds are ");
for(int i=0;i<3;i++)
{
printf(" %d ",c[i]);
}
////////
printf("\nGrade of first student for three rounds are ");
for(int i=0;i<3;i++)
{
switch(a[i])
{
case 2: printf(" A"); break;
case 3: printf(" A"); break;
case 4: printf(" S"); break;
case 5: printf(" S"); break;
case 0: printf(" B"); break;
case 1: printf(" B"); break;
}
}
//////
printf("\nGrade of second student for three rounds are");
for(int i=0;i<3;i++)
{
switch(b[i])
{
case 2: printf(" A"); break;
case 3: printf(" A"); break;
case 4: printf(" S"); break;
case 5: printf(" S"); break;
case 0: printf(" B"); break;
case 1: printf(" B"); break;
}
}
///////
printf("\nGrade of third student for three rounds are");
for(int i=0;i<3;i++)
{
switch(c[i])
{
case 2: printf(" A"); break;
case 3: printf(" A"); break;
case 4: printf(" S"); break;
case 5: printf(" S"); break;
case 0: printf(" B"); break;
case 1: printf(" B"); break;
}
}
printf("\n");
////////
a[3]=a[0];
for(int i=0;i<3;i++)
if(a[i]>=4)
{
printf("first student is carnatic singer\n");
}
else if(a[i]+a[i++]>=4)
{
printf("first student is carnatic singer\n");
}
/////////
b[3]=b[0];
for(int i=0;i<3;i++)
if(b[i]>=4)
{
printf("second student is carnatic singer\n");
}
else if(b[i]+b[i++]>=4)
{
printf("second student is carnatic singer\n");
}
/////////
c[3]=c[0];
for(int i=0;i<3;i++)
if(c[i]>=4)
{
printf("third student is carnatic singer\n");
}
else if(c[i]+c[i++]>=4)
{
printf("third student is carnatic singer\n");
}
///////////
float p=(a[0]+a[1]+a[2])/3;
float q=(b[0]+b[1]+b[2])/3;
float r=(c[0]+c[1]+c[2])/3;
//////////
printf("the avg marks of first student is %f\n",p);
printf("the avg marks of second student is %f\n",q);
printf("the avg marks of third student is %f\n",r);
}