Advertisement
Spocoman

05. Special Numbers

Sep 12th, 2023
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.     int num;
  9.     cin >> num;
  10.  
  11.     for (int num1 = 1; num1 <= 9; num1++) {
  12.         for (int num2 = 1; num2 <= 9; num2++) {
  13.             for (int num3 = 1; num3 <= 9; num3++) {
  14.                 for (int num4 = 1; num4 <= 9; num4++) {
  15.                     if (num % num1 == 0 && num % num2 == 0 && num % num3 == 0 && num % num4 == 0)
  16.                     {
  17.                         cout << num1 << num2 << num3 << num4 << " ";
  18.                     }
  19.                 }
  20.             }
  21.         }
  22.     }
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement