Advertisement
koksibg

Магически числа

Aug 23rd, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             for (int i1 = 111111; i1 < 999999; i1++)
  16.             {
  17.                 int a = i1 % 10;
  18.                 int b = (i1 / 10) % 10;
  19.                 int c = (i1 / 100) % 10;
  20.                 int d = (i1 / 1000) % 10;
  21.                 int e = (i1 / 10000) % 10;
  22.                 int f = (i1 / 100000) % 10;
  23.                 if (a * b * c * d* e * f == n)
  24.                 Console.Write($"{f}{e}{d}{c}{b}{a} ");
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement