How to create a KBC like game using C language?

By | January 4, 2022

The simplest and easiest way to create a KBC like game with c language is by using if -else

#include<stdio.h>
#include<conio.h>
int main()
{
int i,a[10],n=0;
printf("\t\t\t\t\t\tWELCOME TO THE GAME \n");
printf("\t\t\t\t\t\tKAUN BANEGA CROREPATHI\n");
printf("YOU HAVE TO CHOOSE THE COORECT ANSWER OF 10 QUESTIONS \n ONE WRONG ANSWER AND YOU WOULD BE DISQUALIFIED\n THE Game starts now:---\n");
for(i=1;i<=10;i++)
{
n=0;
switch(i)
{
case 1:
printf("What is the rank of India in Organ Donation, as per Global Observatory on Donation and Transplantation (GODT)?");
printf("\n[1] First [2] Third [3] Fifth [4] Seventh\n");
scanf("%d",&n);
if(n==2)
{
printf(" CONGRATULATIONS you have entered the correct answer \n YOU have wonRs.%d00000 Your Next Question is \n",i);
}
else
{
printf(" You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 2:
printf("The India Young Water Professional Programme has been launched for the first time, in association with which country?\n");
printf("[1] USA[2] Russia[3] Australia[4] Japan");
scanf("%d",&n);
if(n==3)
{
printf(" CONGRATULATIONS you have entered the correct answer \n YOU have won Rs.%d00000 Your Next Question is ",i);
}
else
{
printf(" You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 3:
printf("Al Raisi, has been elected as the President of which international organization? \n");
printf("[1] United Nation [2] International Monetary Fund [3] Interpol[4] UNICEF");
scanf("%d",&n);
if(n==3)
{
printf(" CONGRATULATIONS you have entered the correct answer \n YOU have won Rs.%d00000 Your Next Question is ",i);
}
else
{
printf(" You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 4:
printf(" \n Hanukkah, is a celebration held every year by which group of population? \n");
printf("[1] Jews [2] Christians [3] Muslims [4] Sikhs\n");
scanf("%d",&n);
if(n==3)
{
printf("CONGRATULATIONS you have entered the correct answer \n YOU have won Rs.%d00000 Your Next Question is ",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified You have earned earned Rs.%d00000",i-1);
i=11;
}
break;
case 5:
printf("Alexia Putellas, who won the women’s Ballon dOr award 2021, belongs to which country? \n");
printf("[1] France [2] Spain [3] UK [4] Argentina");
scanf("%d",&n);
if(n==3)
{
printf("CONGRATULATIONS you have entered the correct answer \n YOU have wonRs.%d00000Your Next Question is",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 6:
printf("\nWho Heads Reserve Bank of India ? /n");
printf("[1].FinanceMinister [2]Commissioner [3]Chief Bank Manager [4]Governor");
scanf("%d",&n);
if(n==4)
{
printf("CONGRATULATIONS you have entered the correct answer \n YOU have wonRs.%d00000Your Next Question is",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified have earned Rs.%d00000",i-1);
i=11;
}
break ;
case 7:
printf("\nIndia is set to assume the G20 Presidency in which year?\n");
printf("[1] 2022 [2] 2023[3] 2034[4] 2035");
scanf("%d",&n);
if(n==2)
{
printf("CONGRATULATIONS you have entered the correct answer \n YOU have wonRs.%d00000Your Next Question is",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 8:
printf("\n Which Indian-born economist is to be appointed as the first Deputy Managing Director of IMF? \n");
printf("[1] Urjit Patel [2] Raghuram Rajan[3] Gita Gopinath[4] Usha Thorat");
scanf("%d",&n);
if(n==3)
{
printf("CONGRATULATIONS you have entered the correct answer \n YOU have wonRs.%d00000Your Next Question is",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 9:
printf(" \n Which association has launched a ($340 billion) project named ”Global Gateway”?\n");
printf("[1] G-20[2] European Union [3] ASEAN [D] G-7");
scanf("%d",&n);
if(n==2)
{
printf(" CONGRATULATIONS you have entered the correct answer \n YOUhave wonRs.%d00000Your Next Question is",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
case 10:
printf(" \n Hornbill Festival’ is a cultural festival celebrated in which state/UT");
printf("\n [1] Assam[2] Nagaland[3] West Bengal[4] Bihar");
scanf("%d",&n);
if(n==2)
{
printf("CONGRATULATIONS\n \\\\\\\\\\\\\\\\\\\\\\YOU HAVE BECOME CROREPATHI\\\\\\\\\\\\\\\\*",i);
}
else
{
printf("You have entered the wrong answer YOU are disqualified You have earned Rs.%d00000",i-1);
i=11;
}
break;
default:
break;
}
}
getch();
} 

Output:

How to create a KBC like game using C language?

Leave a Reply

Your email address will not be published. Required fields are marked *