Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06.MagicNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int magicNumber = int.Parse(Console.ReadLine());
- //111111 до 999999
- for (int stohil = 1; stohil <= 9; stohil++)
- {
- for (int desetohil = 1; desetohil <= 9; desetohil++)
- {
- for (int hil = 1; hil <= 9; hil++)
- {
- for (int stot = 1; stot <= 9; stot++)
- {
- for (int des = 1; des <= 9; des++)
- {
- for (int ed = 1; ed <= 9; ed++)
- {
- //генерирано число
- //ако ст * десхил * хил * стот * дес* ед == маг
- if (stohil * desetohil * hil * stot * des * ed == magicNumber)
- {
- Console.Write($"{stohil}{desetohil}{hil}{stot}{des}{ed} ");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment