Program to find whether a given number is palindrome or not

We have to implement an algorithm to check the number is palindrone or not

#include<stdio.h>
int main(){
int n,r,res=0,a;
printf("ENter a number : ");
scanf("%d",&n);
a=n;
while(n!=0){
r=n%10;
res=res*10+r;//321
n=n/10;
}
printf("reverse is : %d\n",res);
if(a==res){
printf("palindrome");
} else{
printf("not a palindrome");
}
return 0;
}
view raw 4f-ip.c hosted with ❤ by GitHub

Post a Comment

1 Comments

Ad Code

Join our New Telegram Channel