Niloy007

Pranto's Problem 4

Mar 23rd, 2021
625
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.     int reverse = 0, n;
  6.     printf("Enter a nuber:\n");
  7.     scanf("%d", &n);
  8.     int num = n;
  9.  
  10.     while (n > 0) {
  11.         reverse = (reverse * 10) + (n % 10);
  12.         n /= 10;
  13.     }
  14.     if (num == reverse) {
  15.         printf("%d is a palindrome number\n", num);
  16.     } else {
  17.         printf("%d is not a palindrome number\n", num);
  18.     }
  19. }
RAW Paste Data