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 ConsoleApplication23
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random a = new Random();
- Random b = new Random();
- int correct_solution = 0;
- Console.WriteLine("The task is to solve 3 examples");
- for(int i=0; i<3; i++)
- {
- int a1 = a.Next(1, 9);
- int b1 = b.Next(1, 9);
- int sum = a1 + b1;
- Console.WriteLine("Pls caluclate the result!");
- Console.WriteLine("{0} + {1} = ", a1, b1);
- int sum1 = Convert.ToInt32(Console.ReadLine());
- if(sum1 == sum)
- {
- Console.WriteLine(" {0} is correct", sum1);
- correct_solution++;
- }
- else
- {
- Console.WriteLine("the result is incorrect!");
- Console.WriteLine("the correct answer is {0}", sum);
- }
- }
- Console.WriteLine("you have {0} correct answers", correct_solution);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement