Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _12.TheSongOfThe_wheels
- {
- class TheSongOfTheWheels
- {
- static void Main(string[] args)
- {
- int controlNumber = int.Parse(Console.ReadLine());
- int first = 0;
- int second = 0;
- int third = 0;
- int fourth = 0;
- int counter = 0;
- bool isTrue = false;
- bool newRow = false;
- for (int i = 1; i <= 9; i++)
- {
- for (int j = 1; j <= 9; j++)
- {
- for (int k = 1; k <= 9; k++)
- {
- for (int l = 1; l <= 9; l++)
- {
- if (i * j + k * l == controlNumber && i < j && k > l)
- {
- newRow = true;
- counter++;
- Console.WriteLine($"{i}{j}{k}{l} ");
- if (counter == 4)
- {
- isTrue = true;
- first = i;
- second = j;
- third = k;
- fourth = l;
- }
- }
- }
- }
- }
- }
- if (newRow)
- {
- Console.WriteLine();
- }
- if (isTrue)
- {
- Console.WriteLine($"Password: {first}{second}{third}{fourth}");
- }
- else
- {
- Console.WriteLine("No!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement