Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- long int num, rev, rem, bnum;
- printf("This is a simple program to check Palindrome Number.\n\n");
- printf("Enter a number : ");
- scanf("%ld", &num);
- bnum = num;
- rev = 0;
- while(num != 0)
- {
- rem = num % 10;
- rev = rev * 10 + rem;
- num = num / 10;
- }
- if(bnum == rev)
- {
- printf("%ld - is a Palindrome Number.", bnum);
- }
- else
- {
- printf("%ld - is not a Palindrome Number.", bnum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement