Advertisement
v4m4v4

SpecialNumber

Nov 2nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. // SpecialNumbers.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n;
  11.     cin >> n;
  12.  
  13.     int digit4 = 0;
  14.     int digit3 = 0;
  15.     int digit2 = 0;
  16.     int digit1 = 0;
  17.  
  18.     for (int i = 1; i <= 9; i++)
  19.     {
  20.         for (int k = 1; k <= 9; k++)
  21.         {
  22.             for (int j = 1; j <= 9; j++)
  23.             {
  24.                 for (int g = 1; g <= 9; g++)
  25.                 {
  26.                     int special_number;
  27.                     digit4 = i / 1000;
  28.                     digit3 = k / 100 % 10;
  29.                     digit2 = j / 10 % 10;
  30.                     digit1 = g % 10;
  31.                     if (special_number = n % digit1 == 0 && n % digit2 == 0
  32.                         && n % digit3 == 0 && n % digit4 == 0)
  33.                     {
  34.                         cout << digit1 << digit2 << digit3 << digit4 << " ";
  35.                     }
  36.                 }
  37.             }
  38.         }
  39.     }
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement