bacco

Специални числа

Feb 20th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Купа  
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             for (int one = 1; one <= 9; one++)
  12.             {
  13.                 for (int two = 1; two <= 9; two++)
  14.                 {
  15.                     for (int three = 1; three <= 9; three++)
  16.                     {
  17.                         for (int four = 1; four <= 9; four++)
  18.                         {
  19.                             if (n % one == 0 &&
  20.                                 n % two == 0  &&  
  21.                                 n % three == 0 &&
  22.                                 n % four == 0)
  23.                             {
  24.                                 Console.Write($"{one}{two}{three}{four} ");
  25.                             }
  26.                         }
  27.                     }
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
  33.  
  34.  
  35. //                                      Специални числа
  36.  
  37. //                                      Пример  3
  38.  
  39. //                                      1111 1113 1131 1133 1311
  40. //                                      1313 1331 1333 3111 3113
  41. //                                      3131 3133 3311 3313 3331
  42. //                                      3333
Advertisement
Add Comment
Please, Sign In to add comment