[go: up one dir, main page]

0% found this document useful (0 votes)
6 views3 pages

Code KBC

Uploaded by

kumarnikhil25341
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Code KBC

Uploaded by

kumarnikhil25341
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CODE:

import java.util.Scanner;

public class KBC {

public static void main(String[] args) {


String[][] questions = {
{"WHO IS THE FIRST PRIME MINISTER OF INDIA?", "JAWAHARLAL NEHRU", "MAHATMA GANDHI",
"DR. B. R. AMBEDKAR", "N. P. J", "NONE", "1"},
{"WHO IS PRESIDENT OF INDIA?", "DR. B. R. AMBEDKAR", "MAHATMA GANDHI", "N. P. J",
"JAWAHARLAL NEHRU", "NONE", "2"},
{"WHO IS THE FIRST WOMAN TO WIN A NOBEL PRIZE IN PHYSICS?", "MARIE CURIE", "ALBERT
EINSTEIN", "SALLY RIDE", "NONE", "3"},
{"what is the capital of india?", "DELHI", "MUMBAI", "KOLKATA", "CHENNAI", "NONE", "1"},
{"what city is known as the city of dreams?", "DELHI", "MUMBAI", "KOLKATA", "CHENNAI",
"NONE", "2"},
{"what city is known as the pilot city of india?", "DELHI", "MUMBAI", "KOLKATA", "CHENNAI",
"NONE", "3"},
{"The International Literacy Day is observed on", "Sep 8", "Nov 28", "May 2", "Telugu", "NONE",
"1"},
{"The language of Lakshadweep, a Union Territory of India, is", "Tamil", "Hindi", "Malayalam",
"Telugu", "NONE", "3"},
{"The language of Lakshadweep, a Union Territory of India, is", "Tamil", "Hindi", "Malayalam",
"Telugu", "3"},
{"Diwali festival is related to", "Islam", "Hinduism", "Buddhism", "Jainism", "2"},
{"Which day is observed as the World Standards", "June 26", "Oct 14", "Nov 15", "Dec 2", "2"},
{"In which group of places the Kumbha Mela is held every twelve years?", "ujjain. Puri; Prayag.
Haridwar", "Prayag. Haridwar, Ujjain", "Prayag. Haridwar, Nasik", "Rameshwaram. Puri, Badrinath",
"Chittakoot, Ujjain, Prayag, Haridwar", "2"},
{"September 27 is celebrated every year as", "Teachers' Day", "National Integration Day", "World
Tourism Day", "International Literacy Day", "3"},
{"Who is the author of 'Manas Ka-Hans'?", "Khushwant Singh", "Prem Chand", "Jayashankar
Prasad", "Amrit Lal Nagar", "2"},
{"Who is the author of the epic 'Meghdoot'?", "Vishakadatta", "Valmiki", "Banabhatta", "Kalidas",
"4"}
};
int[] price = {1000, 2000, 3000, 5000, 10000, 20000, 40000, 80000, 160000, 320000, 640000,
1250000, 2500000, 5000000, 10000000};
int amount = 0;
int score = 0;
Scanner scanner = new Scanner(System.in);

System.out.println("\n------------WELCOME TO KBC------------\n");

for (int index = 0; index < questions.length; index++) {


String[] q = questions[index];
System.out.println("\n " + q[0]);
System.out.println("1. " + q[1] + " 2. " + q[2]);
System.out.println("3. " + q[3] + " 4. " + q[4] + "\n");
System.out.print("Enter your answer (1-4): ");
int ans = scanner.nextInt();

if (Integer.toString(ans).equals(q[q.length - 1])) {
System.out.println("(•ᴗ•) Correct answer, You won " + price[index]);
score++;
if (index == 4) {
amount = 10000;
} else if (index == 9) {
amount = 320000;
} else if (index == 14) {
amount = 10000000;
}
} else {
System.out.println("( •̯́ ₃ •̯́) Wrong answer");
break;
}
}

System.out.println("\n ≽^•⩊•^≼ Your Winning Amount is " + amount + " and your score is " +
Math.round(((double) score / 15) * 100) + " out of 100");

scanner.close();
}
}
OUTPUT:

You might also like