Advertisement
Spocoman

12. The song of the wheels

Sep 12th, 2023
1,274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include<string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int number, counter = 0;
  8.     cin >> number;
  9.  
  10.     string print = "No!";
  11.    
  12.     for (int a = 1; a <= 9; a++) {
  13.         for (int b = 1; b <= 9; b++) {
  14.             for (int c = 1; c <= 9; c++) {
  15.                 for (int d = 1; d <= 9; d++) {
  16.                     if (a * b + c * d == number && a < b && c > d) {
  17.                         cout << a << b << c << d << " ";
  18.                         counter++;
  19.                         if (counter == 4) {
  20.                             print = "Password: " + to_string(a) + to_string(b) + to_string(c) + to_string(d);
  21.                         }
  22.                     }
  23.                 }
  24.             }
  25.         }
  26.     }
  27.     cout << "\n" << print << endl;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement