-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathsimplequiz.c
74 lines (73 loc) · 2.17 KB
/
simplequiz.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
//Simple quiz game using C
#include <stdio.h>
int main()
{
int a, b, c, d = 0, e;
printf("Hey , Welcome to small Quiz app\n");
printf("Press 1 to start\n");
scanf("%d", &e);
if (e == 1)
{
for (b = 0; b < 5; b++)
{
if (b == 0)
{
printf("What is capital city of Nepal?\n");
printf("1.Pokhara\n2.Kathmandu\n3.Mahendranagar\n");
printf("Give ans in numbers \n");
scanf("%d", &c);
if (c == 2)
{
d = d + 10;
}
}
else if (b == 1)
{
printf("How many bits are there in one Byte?\n");
printf("1.Three\n2.Five\n3.Eight\n");
printf("Give ans in numbers \n");
scanf("%d", &c);
if (c == 3)
{
d = d + 10;
}
}
else if (b == 2)
{
printf("What is the collection of 4 bits called?\n");
printf("1.One Byte\n2.One Nibble\n3.One KiloBye\n");
printf("Give ans in numbers \n");
scanf("%d", &c);
if (c == 2)
{
d = d + 10;
}
}
else if (b == 3)
{
printf("What is capital city of USA?\n");
printf("1.Washington DC\n2.New York\n3.LA\n");
printf("Give ans in numbers \n");
scanf("%d", &c);
if (c == 1)
{
d = d + 10;
}
}
else
{
printf("What is capital city of India?\n");
printf("1.Chennai\n2.Mumbai\n3.Delhi\n");
printf("Give ans in numbers \n");
scanf("%d", &c);
if (c == 3)
{
d = d + 10;
}
}
}
}
printf("You scored %d points out of 50 points\n", d);
return 0;
}
//End of program