Saleh127

Untitled

Apr 11th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int n, rev = 0, rem,org;
  5. scanf("%d", &n);
  6. org = n;
  7. while (n != 0)
  8. {
  9. rem = n % 10;
  10. rev = rev * 10 + rem;
  11. n /= 10;
  12. }
  13. if (org == rev)
  14. {
  15. printf("Palindrome\n");
  16. }
  17. else
  18. {
  19. printf("Not palindrome\n");
  20. }
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment