Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- int magicNumber = int.Parse(Console.ReadLine());
- int sum = 0;
- for (int firstDigit = 1; firstDigit <= magicNumber; firstDigit++)
- {
- for (int secondDigit = 1; secondDigit <= magicNumber; secondDigit++)
- {
- for (int thirdDigit = 1; thirdDigit <= magicNumber; thirdDigit++)
- {
- for (int fourthDigit = 1; fourthDigit <= magicNumber; fourthDigit++)
- {
- for (int fifthDigit = 1; fifthDigit <= magicNumber; fifthDigit++)
- {
- for (int sixthDigit = 1; sixthDigit <= magicNumber; sixthDigit++)
- {
- sum = firstDigit * secondDigit * thirdDigit * fourthDigit * fifthDigit * sixthDigit;
- if (sum == magicNumber)
- {
- Console.Write($"{firstDigit}{secondDigit}{thirdDigit}{fourthDigit}{fifthDigit}{sixthDigit} ");
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment