Advertisement
Guest User

Untitled

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