Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace program
- {
- class Program
- {
- static void Main(string[] args)
- {
- start:
- Console.WriteLine("How many questions do you wanna answer");
- int a = Convert.ToInt32(Console.ReadLine());
- Console.Clear();
- int wrong = 0;
- int correct = 0;
- for (int i = 0; i < a; i++)
- {
- Random rnd = new Random();
- int sum1 = rnd.Next(1, 11);
- int sum2 = rnd.Next(1, 11);
- int answer;
- int option = rnd.Next(1, 4);
- int question = option;
- string question2 = "";
- if (question == 1)
- {
- question2 = "+";
- }
- if (question == 2)
- {
- question2 = "X";
- }
- if (question == 3)
- {
- question2 = "-";
- }
- Console.WriteLine("Asnwer this question!");
- Console.WriteLine("What is:" + sum1 + " " + question2 + " " + sum2);
- answer = Convert.ToInt32(Console.ReadLine());
- if (option == 1)
- {
- if (answer == sum1 + sum2)
- {
- Console.WriteLine("Well done bro!");
- correct++;
- }
- else
- {
- Console.WriteLine("Wrong! keep practicing bro!");
- wrong++;
- }
- }
- else if (option == 2)
- {
- if (answer == sum1 * sum2)
- {
- Console.WriteLine("Well done bro!");
- correct++;
- }
- else
- {
- Console.WriteLine("Wrong! keep practicing bro!");
- Console.Beep();
- wrong++;
- }
- }
- else if (option == 3)
- {
- if (answer == sum1 - sum2)
- {
- Console.WriteLine("Well done bro!");
- correct++;
- }
- else
- {
- Console.WriteLine("Wrong! keep practicing bro!");
- Console.Beep();
- wrong++;
- }
- }
- Console.Clear();
- }
- Console.WriteLine("you got: " + correct + " correct and: " + wrong + "wrong");
- Console.WriteLine("do you want to exit? \n then type yes");
- string yes = Console.ReadLine();
- if (yes == "yes")
- {
- System.Environment.Exit(1);
- }
- else { goto start; }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement