C program to cheak if a number is a palandrome or not.
Table of contents
No headings in the article.
Here is a program to cheak if a number is a palandrome or not.
A word, sentence, verse, or even number that reads the same backward or forward.
#include<stdio.h>
int palandrome(int n);
int main(){
int n;
printf("Enter the number you want to find the palandrome\n");
scanf("%d",&n);
if (palandrome(n))
{
printf("Yes is a palandrome");
}
else {
printf("Not a palandrome");
}
return 0;
}
int palandrome(int n)
{
int real=n;
int rem,sum=0;
while(n>0){
rem=n%10;
sum=sum*10+rem;
n=n/10;
}
if (sum==real){
return 1;
}
else{
return 0;
}
}
This part of the code does all the work.
rem=n%10;
sum=sum*10+rem;
n=n/10;
Hope this blog was helpfull. Dont forget to follow.
Thankyou...