Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int sum = 0;
- int firstDigit = n / 1000;
- int secondDigit = (n / 100) % 10;
- int thirdDigit = (n / 10) % 10;
- int fourthDigit = n % 10;
- sum = firstDigit + secondDigit + thirdDigit + fourthDigit;
- int one = 0;
- int two = 0;
- int three = 0;
- int four = 0;
- int five = 0;
- int six = 0;
- bool sequenceFound = false;
- for (int i = 0; i < 6; i++)
- {
- one = i;
- for (int j = 0; j < 6; j++)
- {
- two = j;
- for (int k = 0; k < 6; k++)
- {
- three = k;
- for (int m = 0; m < 6; m++)
- {
- four = m;
- for (int o = 0; o < 6; o++)
- {
- five = o;
- for (int p = 0; p < 6; p++)
- {
- six = p;
- int product = one * two * three * four * five * six;
- if (product == sum)
- {
- sequenceFound = true;
- string result = "" + one + two + three + four + five + six;
- foreach (char digit in result)
- {
- switch (digit)
- {
- case '0': Console.Write("-----|"); break;
- case '1': Console.Write(".----|"); break;
- case '2': Console.Write("..---|"); break;
- case '3': Console.Write("...--|"); break;
- case '4': Console.Write("....-|"); break;
- case '5': Console.Write(".....|"); break;
- default: break;
- }
- }
- Console.WriteLine();
- }
- }
- }
- }
- }
- }
- }
- if (sequenceFound == false)
- {
- Console.WriteLine("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement