Advertisement
KedrikFeeD

PolindromDuo

Dec 3rd, 2021
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     int a, b, new_chislo, new_chisloDuo, temp, tempDuo;
  5.     cin >> a;
  6.     cin >> b;
  7.     for (int i = a; i <= b; i++) {
  8.         temp = i;
  9.         tempDuo = pow(temp, 2);
  10.         new_chislo = 0;
  11.         new_chisloDuo = 0;
  12.         while (temp != 0) {
  13.             new_chislo = new_chislo * 10 + temp % 10;
  14.             temp /= 10;
  15.         }
  16.         while (tempDuo != 0) {
  17.             new_chisloDuo = new_chisloDuo * 10 + tempDuo % 10;
  18.             tempDuo /= 10;
  19.         }
  20.         if (new_chislo == i && new_chisloDuo == pow(i,2)) {
  21.             cout << i << "\t";
  22.         }
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement