Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int n, copie, invers;
  4. int main()
  5. {
  6. invers = 0;
  7. cout << "Introdu numarul:  "; cin >> n;
  8. copie = n;
  9. while(n != 0)
  10. {
  11.     invers = invers*10 + n%10;
  12.     n = n/10;
  13. }
  14. if (invers == copie)
  15. {
  16.     cout << "Numarul este palindom";
  17. }
  18. else {
  19.     cout << "Numarul nu este palindom";
  20.     return 0;
  21. }
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement