Summer project
Summer project
will be displayed.
o The quiz consists of predefined number
of questions.
o After all questions have been
answered, your final score will be
displayed.
o You will receive feedback based on
your score to indicate your overall
performance.
o Answer honestly without external help
to get an accurate assessment of your
knowledge.
o Have fun and use the game as a
learning tool to improve your
knowledge on various topics
ALGORITHM
Step-1:Start
Step-2:Take two variables - score and answer
Step-3:Initialize score as ‘score=0’
Step-4:Print Welcome Message
Step-5:Print the Questions
Step-6:Print four options for each question
Step-7:Ask the user for input
Step-8:Read the user’s input into user’s answer
Step-9:If user’s answer equals to correct answer
Print “Correct!”
Increment Score
Step-10: Else
Print “Wrong! The Correct answer is:”
followed by the correct option
Step-11: Print “Quiz Over! Your final score is:”
followed by your score and “out of”
followed by the number of Questions
Step-12: Provide Performance Feedback based on
your score
Step-13: If Score==Number of Questions
Print “Excellent!! You got all
questions right!”
Step-14: Else if Score>=Number of Questions/2
Print “Good Job!! You got more than half
right!
Step-15: Else
Print “Better Luck Next Time”
Step-16: Display End Message
Step-17: Stop
FLOWCHART
Start
Take two
variables
score, answer
Initially input
value for score
as ‘score=0’
Print
Welcome
Message
Define Questions,
Options and Correct
answers
for (each
question
from 0 to
no.of
questions-1)
Display
Questions
and Options
Ask User
for answer
Read User’s
answer
T if(User’s F
answer==Co
rrect answer)
Print
Print
Correc
Wrong
t
Display
Increment
Correct
score Answer
Print
Final
Score
Provide
Performance
Feedback
if(Score
==No.o Print
T
f “Excelle
Questio nt”
ns
F
else
T Print
if(Score>=N
“Good
o.of
Job”
Questions/2)
F
Print
“Better Luck
Next Time”
Display
End
Message
Stop
SOURCE CODE
#include<stdio.h>
int main()
{
int score=0;
int answer;
//Question 1
printf("Question 1: Who is the founder of C-Language?\n");
printf("1. Charles Babbage\n");
printf("2. John Warner Backus\n");
printf("3. Dennis Ritchie\n");
printf("4. Grace Murray\n");
printf("Enter your answer:");
scanf("%d",&answer);
if(answer==3)
{
printf("Correct!\n\n");
score++;
}
else
{
printf("Wrong! The Correct answer is 3. Dennis
Ritchie\n\n");
}
//Question 2
printf("Question 2: When was the C-Language
developed?\n");
printf("1. 1960\n");
printf("2. 1972\n");
printf("3. 1989\n");
printf("4. 1992\n");
printf("Enter your answer:");
scanf("%d",&answer);
if(answer==2)
{
printf("Correct!\n\n");
score++;
}
else
{
printf("Wrong!The Correct answer is 2. 1972\n\n");
}
//Question 3
printf("Question 3: A collection of 8 bits is called?\n");
printf("1. Word\n");
printf("2. Bit\n");
printf("3. Record\n");
printf("4. Byte\n");
printf("Enter your answer:");
scanf("%d",&answer);
if(answer==4)
{
printf("Correct!\n\n");
score++;
}
else
{
printf("Wrong!The Correct answer is 4. Byte\n\n");
}
//Final score
printf("Quiz Over! Your Final score is:%d out of
3\n\n",score);
if(score==3)
{
printf("Excellent!!You got all questions right!\n");
}
else if(score==2)
{
printf("Good job! You got more than half
right!");
}
else
{
printf("Better Luck Next Time!!\n");
}
return 0;
}
OUTPUT
In summary, this simple quiz game in C offers a
fun and interactive way to test general knowledge
while learning fundamental programming concepts.
It serves as an excellent project for beginners to
practice data structures, control flow, and user
interaction in C programming. Overall, this quiz
game is a practical and enjoyable application that
enhances both knowledge and coding skills.
In Conclusion
THANK YOU