Skip to main content

Quiz Game in C

 



#include<stdio.h>
void main(){
printf("\n");
printf("\t\tA SIMPLE QUIZ FOR YOU, ANALYSE YOURSELF!\n");
printf("\t\t     *****Let's begin the QUIZ*****\n");
printf("\n");
char ans;
int correct=0;
int incorrect=0;
int i=1;

while(i<=10){
switch(i){

case 1:
printf("1. Which is the biggest continent in the world?\n");
printf("A: North America\nB: Asia\nC: Africa\nD: Australia\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);

if(ans=='B' || ans=='b'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 2:
printf("\n");
printf("2. Which is the longest river in the world?\n");
printf("A: Great Ganga\nB: Nile\nC: Amazon\nD: Niger\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='B' || ans=='b'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 3:
printf("\n");
printf("3. Which is the largest ocean in the world?\n");
printf("A: Indian ocean\nB: Pacific ocean\nC: Arctic ocean\nD: Atlantic ocean\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='B' || ans=='b'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 4:
printf("\n");
printf("4. Which is India's first super computer?\n");
printf("A: Param8000\nB: param80000\nC: param800\nD: param8\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='A' || ans=='a'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 5:
printf("\n");
printf("5. Which bank is called bankers bank of India?\n");
printf("A: Reserve Bank of India\nB: Punjab National Bank\nC: State Bank of India \nD: ICICI\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='A' || ans=='a'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 6:
printf("\n");
printf("6. Which is largest animal in the world?\n");
printf("A: Sharke\nB: Blue whale\nC: Elephant\nD: Giraffe\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='B' || ans=='b'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 7:
printf("\n");
printf("7. Which is largest animal on land?\n");
printf("A: Tiger\nB: White Elephant\nC: African Elephant\nD: Crocodile\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='C' || ans=='c'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 8:
printf("\n");
printf("8. Which is largest island in the world?\n");
printf("A: New Guinea\nB: Andaman Nicobar\nC: Greenland\nD: Hawaii\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='C' || ans=='c'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 9:
printf("\n");
printf("9. Which is largest flower in the world?\n");
printf("A: Rafflesia\nB: Jasmine\nC: Balloon Flower\nD: Camellia\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='A' || ans=='a'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;

case 10:
printf("\n");
printf("10. Which is the 29th state of India?\n");
printf("A: Uttarakhand\nB: Telangana\nC: Uttar Pradesh\nD: Madhya Pradesh\n");
printf("Enter the correct option: ");
scanf(" %c",&ans);
if(ans=='B' || ans=='b'){
correct=correct+1;
}
else{
incorrect=incorrect+1;
}
i++;
}
printf("\n");
printf("Total Marks out of 10: %d\n",correct);

if(correct>=8){
printf("\n");
printf("Very Good, you are so intelligent.");
}
else if(correct<8){
printf("\n");
printf("No Need To Worry, just work hard.");
}

}



}


Comments