IvetValcheva

05. Special Numbers

Dec 4th, 2021
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp17
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             for (int i = 1; i <= 9; i++)
  12.             {
  13.                 for (int j = 1; j <= 9; j++)
  14.                 {
  15.                     for (int k = 1; k <= 9; k++)
  16.                     {
  17.                         for (int m = 1; m <= 9; m++)
  18.                         {
  19.                             if
  20.                                 (
  21.                                 n % i == 0 &&
  22.                                 n % j == 0 &&
  23.                                 n % k == 0 &&
  24.                                 n % m == 0
  25.                                 )
  26.                             {
  27.                                 Console.Write($"{i}{j}{k}{m} ");
  28.                             }
  29.                         }
  30.                     }
  31.                 }
  32.             }
  33.  
  34.         }
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment