Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- main()
- {
- int opt; //Menu options
- int numof; //Number of questions
- int ans; //Answers
- opt=0;
- numof=0;
- ans=0;
- printf("\n________________________________________________________________________________________________________");
- printf("Select an option displayed below________________________");
- printf("________________________________________________________________________________\n\n\n");
- printf("1: Enter the number of questions to be asked for this round of the quiz (maximum of 5 questions allowed).\n\n");
- printf("2: Start quiz\n\n");
- printf("3: Display the number of questions that were answered (i) correctly and (ii) incorrectly for this round.\n\n");
- printf("4: Exit Program\n");
- printf("________________________________________________________________________________\n\n");
- scanf("%d", &opt);
- if(opt==1)
- {
- if(numof==1)
- {
- printf("Let's begin\n");
- printf("12x4=?\n");
- scanf("%d", &ans);
- if(ans==48)
- {
- printf("Success! You are correct");
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 1
- }//End middle if 1
- if(numof==2)
- {
- printf("Let's begin\n");
- printf("12x4=?\n");
- scanf("%d", &ans);
- if(ans==48)
- {
- printf("Success! You are correct\n\n");
- printf("102/2=?\n");
- scanf("%d", &ans);
- if(ans==51)
- {
- printf("Success! You are correct\n");
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 2b
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 2a
- }//End middle if 2
- if(numof==3)
- {
- printf("Let's begin\n");
- printf("12x4=?\n");
- scanf("%d", &ans);
- if(ans==48)
- {
- printf("Success! You are correct\n\n");
- printf("102/2=?\n");
- scanf("%d", &ans);
- if(ans==51)
- {
- printf("Success! You are correct\n\n");
- printf("10/2*3=?\n");
- scanf("%d", &ans);
- if(ans==15)
- {
- printf("Success! You are correct\n\n");
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End innner if 3c
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 3b
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 3a
- }//End middle if 3
- if(numof==4)
- {
- printf("Let's begin\n");
- printf("12x4=?\n");
- scanf("%d", &ans);
- if(ans==48)
- {
- printf("Success! You are correct\n\n");
- printf("102/2=?\n");
- scanf("%d", &ans);
- if(ans==51)
- {
- printf("Success! You are correct\n\n");
- printf("10/2*3=?\n");
- scanf("%d", &ans);
- if(ans==15)
- {
- printf("Success! You are correct\n\n");
- printf("40*2/4=?\n");
- scanf("%d", &ans);
- if(ans==20)
- {
- printf("Success! You are correct\n\n");
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 4d
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End innner if 4c
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 4b
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.");
- }//End inner if 4a
- }//End middle if 4
- if(numof==5)
- {
- printf("Let's begin\n");
- printf("12x4=?\n");
- scanf("%d", &ans);
- if(ans==48)
- {
- printf("Success! You are correct\n\n");
- printf("102/2=?\n");
- scanf("%d", &ans);
- if(ans==51)
- {
- printf("Success! You are correct\n\n");
- printf("10/2*3=?\n");
- scanf("%d", &ans);
- if(ans==15)
- {
- printf("Success! You are correct\n\n");
- printf("40*2/4=?\n");
- scanf("%d", &ans);
- if(ans==20)
- {
- printf("Success! You are correct\n\n");
- printf("75/3*5=?");
- scanf("%d", &ans);
- if(ans==125)
- {
- printf("Success! You are correct\n\n");
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.\n\n");
- }//End inner 5e
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.\n\n");
- }//End inner if 5d
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.\n\n");
- }//End innner if 5c
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.\n\n");
- }//End inner if 5b
- }
- else
- {
- printf("Uh oh, you were wrong. Hard luck.\n\n");
- }//End inner if 5a
- }//End middle if 5
- }//End main if
- flushall();
- getchar();
- }//End main()
Advertisement
Add Comment
Please, Sign In to add comment