File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main() {
4
+ int score = 0;
5
+
6
+ printf("Welcome to the Quiz Game!\n");
7
+
8
+ // Question 1
9
+ printf("\nQuestion 1: What is the capital of France?\n");
10
+ printf("a) London\nb) Paris\nc) Berlin\nd) Madrid\n");
11
+
12
+ char answer1;
13
+ scanf(" %c", &answer1);
14
+
15
+ if (answer1 == 'b' || answer1 == 'B') {
16
+ printf("Correct!\n");
17
+ score++;
18
+ } else {
19
+ printf("Wrong answer. The correct answer is b) Paris.\n");
20
+ }
21
+
22
+ // Question 2
23
+ printf("\nQuestion 2: Which planet is known as the Red Planet?\n");
24
+ printf("a) Earth\nb) Mars\nc) Venus\nd) Jupiter\n");
25
+
26
+ char answer2;
27
+ scanf(" %c", &answer2);
28
+
29
+ if (answer2 == 'b' || answer2 == 'B') {
30
+ printf("Correct!\n");
31
+ score++;
32
+ } else {
33
+ printf("Wrong answer. The correct answer is b) Mars.\n");
34
+ }
35
+
36
+ // Display final score
37
+ printf("\nYour final score is: %d out of 2\n", score);
38
+
39
+ return 0;
40
+ }
You can’t perform that action at this time.
0 commit comments