simonakancheva

Untitled

Apr 21st, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp27
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var N = int.Parse(Console.ReadLine());
  10.             bool spec = true;
  11.             int a;
  12.             int b=1;
  13.             for (int i = 1111; i < 10000; i++)
  14.             {
  15.                 b = i;
  16.                 while (b != 0)
  17.                 {
  18.                     a = b % 10;
  19.                     if (a == 0)
  20.                     {
  21.                         spec = false;
  22.                         break;
  23.                        
  24.                     }
  25.                     else if (N % a == 0) b = b / 10;
  26.                     else
  27.                     {
  28.                         spec = false;
  29.                         break;
  30.                     }
  31.                    
  32.                    
  33.                    
  34.  
  35.                     spec = true;
  36.  
  37.  
  38.                 }
  39.                 if (spec == true) Console.Write(i+" ");
  40.             }
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.         }
  48.     }
  49. }
Add Comment
Please, Sign In to add comment