Advertisement
Spocoman

03. Lucky Numbers

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