C Program to Check Whether a Number is Palindrome or Not
For Explanation Watch Video:
Palindromic Number :
A palindromic number (also known as a numeral palindrome or a numeric palindrome)
is a number (such as 16461) that remains the same when its digits are reversed.
Ex: 1,2,121,22,11,1221
Program:
#include<stdio.h>
int main(){
int n;
printf("Enter the Number: ");
scanf("%d",&n);
int temp = n;
int sum = 0;
while(n>0){
int r = n%10;
sum = r + sum*10;
n = n/10;
}
if(sum==temp){
printf("%d is Palindromic NUmber",temp);
}else{
printf("%d is not Palindromic NUmber",temp);
}
return 0;
}
Comments
Post a Comment