Here I have created simple general knowledge (GK) Quiz program in C. In this program at first I declared integer variable x which will be our total score. Then I declared some char variable and one char array ch1[100].  Then I took name of the user using this line:

here %[^\n]  means take input string until new line.

You need to add getchar()  after taking full string because it will hold the last new line input.

Then it will print Welcome the user.

Main step for this program:

Then it will print first question and tell the user to answer the question. After entering any value then it will check if the answer is correct or not by comparing (ch2=='a')  user input and the write answer. If the answer is correct then 10 will add with x variable and if the is not correct then it will print “Sorry wrong answer”.

system(“cls”): This function will clear the whole console. To use this function I had to include stdlib.h library.

End Main step

In this step for now I have added 11 questions for this general knowledge (GK) program.

Simple General Knowledge (GK) Quiz Program in C

Simple General Knowledge (GK) Quiz Program in C

After all questions,

If total score “x” is equal to 100, then it will print

If total score “x” is equal to 90, then it will print

Simple General Knowledge (GK) Quiz Program in C

If total score “x” is equal to 80, then it will print

Simple General Knowledge (GK) Quiz Program in C

If x == 50 || x == 70 || x == 60  then it will print

If total score “x” is equal or smaller than 40, then it will print

No use........ Not even 5 questions right

Simple General Knowledge (GK) Program in C

Download source code for Simple General Knowledge (GK) Quiz program in C with EXE file

LEAVE A REPLY

Please enter your comment!
Please enter your name here