Advertisement
myloyo

3.3.18

Oct 31st, 2022 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8.     int x, a, b;
  9.     x = 10;
  10.     while (x != 100) {
  11.         a = x % 10;
  12.         b = x / 10;
  13.         if ((b > a) && (((a + 1) == b) || (a == b))) {
  14.             cout << x << " ";
  15.         }
  16.         x++;
  17.     }
  18.    
  19.     x = 10;
  20.    
  21.     do {
  22.         a = x % 10;
  23.         b = x / 10;
  24.         if ((b > a) && (((a + 1) == b) || (a == b))) {
  25.             cout << x << " ";
  26.         }
  27.         x++;
  28.     }
  29.     while (x != 100);
  30.  
  31.     for (int i = 10; i != 100; i++) {
  32.         a = x % 10;
  33.         b = x / 10;
  34.         if ((b > a) && ((a + 1) == b || (a == b))) {
  35.             cout << x << " ";
  36.         }
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement