Advertisement
Realratnadwip

Number Palindrome

Jun 25th, 2025
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | Source Code | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void main()
  5. {
  6.     long int num, rev, rem, bnum;
  7.  
  8.     printf("This is a simple program to check Palindrome Number.\n\n");
  9.     printf("Enter a number : ");
  10.     scanf("%ld", &num);
  11.  
  12.     bnum = num;
  13.     rev = 0;
  14.  
  15.     while(num != 0)
  16.     {
  17.         rem = num % 10;
  18.         rev = rev * 10 + rem;
  19.         num = num / 10;
  20.     }
  21.  
  22.     if(bnum == rev)
  23.     {
  24.         printf("%ld - is a Palindrome Number.", bnum);
  25.     }
  26.     else
  27.     {
  28.         printf("%ld - is not a Palindrome Number.", bnum);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement