Advertisement
ramsess

Special_number_V1

Mar 2nd, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Special_number
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main (string[] args)
  8.         {
  9.             var n = int.Parse (Console.ReadLine ());
  10.  
  11.             int a = 0;
  12.             int b = 0;
  13.             int c = 0;
  14.             int d = 0;
  15.  
  16.             for (int i = 1111; i < 9999; i++) {
  17.                 a = (i % 10);
  18.                 b = (i / 10 % 10);
  19.                 c = (i / 100 % 10);
  20.                 d = (i / 1000 % 10);
  21.  
  22.                 if ((a != 0) && (n % a == 0)) {
  23.                     if ((b != 0) && (n % b == 0)) {
  24.                         if ((c != 0) && (n % c == 0)) {
  25.                             if ((d != 0) && (n % d == 0)) {
  26.                                 Console.Write ("{0} ", i);
  27.                             }
  28.                         }
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement