Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BinomialEqualitiesGenerator
- {
- class Program
- {
- private static Random RND = new Random();
- static void Main(string[] args)
- {
- while (true)
- {
- int Difficulty;
- do
- {
- Console.WriteLine("Choose a difficulty between 10 and " + ushort.MaxValue + " (inclusive)");
- } while (!(int.TryParse(Console.ReadLine(), out Difficulty) && Difficulty >= 10 && Difficulty <= ushort.MaxValue));
- int X = RND.Next(1, Difficulty);
- int Y = RND.Next(1, Difficulty);
- int LeftX = RND.Next(1, Difficulty);
- int LeftY = RND.Next(1, Difficulty);
- int RightX = RND.Next(1, Difficulty);
- int RightY = RND.Next(1, Difficulty);
- int LeftConst = RND.Next(((X + Y) / 2) * -1, (X + Y) / 2);
- int LeftValue = (LeftX * X) + (LeftY * Y) + LeftConst;
- int RightValue = (RightX * X) + (RightY * Y);
- int RightConst = LeftValue - RightValue;
- Console.WriteLine(LeftX + "x+" + LeftY + "y" + (LeftConst > 0 ? "+" : "") + LeftConst + "=" + RightX + "x+" + RightY + "y" + (RightConst > 0 ? "+" : "") + RightConst);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement