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;
- namespace littleprofessor
- {
- class Program
- {
- static void Main(string[] args)
- {
- int akrai;
- int first;
- Random rnd = new Random();
- Random num = new Random();
- int correct=0;
- int answer = 0;
- Console.WriteLine("How many questions?");
- int questions;
- do
- {
- questions = int.Parse(Console.ReadLine());
- }
- while (questions < 1);
- Random num2 = new Random();
- Console.WriteLine("Choose level of difficulty from 1 to 3, 1 is easiest, 3 is hardest");
- int level=0;
- do
- {
- level = int.Parse(Console.ReadLine());
- }
- while ((level < 1) || (level > 3));
- for (int i = 1; i <= questions; i++)
- {
- if (level == 1)
- {
- akrai = rnd.Next(3);
- if (akrai==1)
- {
- first = num.Next(9) + 1;
- int second = num2.Next(9) + 1;
- Console.WriteLine(first + "+" + second + "=");
- correct = first + second;
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Try again");
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Wrong! " + first + "+" + second + "=" + correct);
- }
- }
- }
- if (akrai==2)
- {
- int second = num2.Next(9) + 1;
- int first = num.Next(9) + second;
- Console.WriteLine(first + "-" + second + "=");
- correct = first - second;
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Try again");
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Wrong! " + first + "-" + second + "=" + correct);
- }
- }
- }
- if (akrai==3)
- {
- int second = num2.Next(9) + 1;
- int first = num.Next(9) + 1;
- Console.WriteLine(first + "*" + second + "=");
- correct = first * second;
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Try again");
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Wrong! " + first + "*" + second + "=" + correct);
- }
- }
- }
- if (akrai == 0)
- {
- do
- {
- int second = num2.Next(9) + 1;
- int first = num.Next(9) + second;
- }
- while (num1%num2!=0);
- }
- Console.WriteLine(first + "-" + second + "=");
- correct = first - second;
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Try again");
- answer = int.Parse(Console.ReadLine());
- if (answer == correct)
- {
- Console.WriteLine("Correct!");
- }
- else
- {
- Console.WriteLine("Wrong! " + first + "-" + second + "=" + correct);
- }
- }
- }
- akrai = 2;
- }
- if (level == 2)
- {
- }
- if (level == 3)
- {
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment