Create a quiz program that asks the user for 5 questions For

Create a quiz program that asks the user for 5 questions. For each correct guess, the user gets 1 point and 0 point for incorrect guess. The program should keep track of how many questions the user has answered correctly and incorrectly and display these running totals at the end of the quiz. .

Solution

# include <stdi.h>

int main()

int x=0,y=0 ,no1,no2,no3,no4,no5;

printf(\"Quiz1: What is the square of 12?:);

scanf(\"%d\", &no1);

if(no1 = 144)

{

printf(\"correct% \ \", no1);

x=1;

}

else

{

printf(\"wrong% \ \", 144);

y=2

}

//second quiz

printf(\"Quiz2: What is the square of 10?:);

scanf(\"%d\", &no2);

if(no2 = 100)

{

printf(\"correct% \ \", no2);

x=x+1;

}

else

{

printf(\"wrong% \ \", 100);

y=y+1

}

//thirdquiz

printf(\"Quiz3: What is the square of 5?:);

scanf(\"%d\", &no3);

if(no3 = 25)

{

printf(\"correct% \ \", no3);

x=x+1;

}

else

{

printf(\"wrong% \ \", 25);

y=y+1;

}

//forth quiz

printf(\"Quiz4: What is the square of 25?:);

scanf(\"%d\", &no4);

if(no4 = 625)

{

printf(\"correct% \ \", no4);

x=x+1;

}

else

{

printf(\"wrong% \ \", 625);

y=y+1;

}

//fifth quiz

printf(\"Quiz5: What is the square of 100?:);

scanf(\"%d\", &no5);

if(no5 = 10000)

{

printf(\"correct% \ \", no5);

x=x+1;

}

else

{

printf(\"wrong% \ \", 10000);

y=y+1;

}

printf(\"you have answer correctly % \ \", x);

printf(\"you have answer wrongly% \ \", y);

}

Create a quiz program that asks the user for 5 questions. For each correct guess, the user gets 1 point and 0 point for incorrect guess. The program should keep
Create a quiz program that asks the user for 5 questions. For each correct guess, the user gets 1 point and 0 point for incorrect guess. The program should keep
Create a quiz program that asks the user for 5 questions. For each correct guess, the user gets 1 point and 0 point for incorrect guess. The program should keep

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site