#include <stdio.h>
#include <string.h>
int main(){
char string1[20];
int i, length;
int flag = 0;
printf("Enter a string:");
scanf("%s", string1);
length = strlen(string1);
for(i=0;i < length ;i++){
if(string1[i] != string1[length-i-1]){
flag = 1;
break;
}
}
if (flag) {
printf("%s is not a palindrome", string1);
}
else {
printf("%s is a palindrome", string1);
}
return 0;
}
#include<stdio.h>
void main(){
int num, cNum, rev, rem;
printf("Enter a number = ");
scanf("%d",&num); //0
cNum = num; //123
rev = 0;
while(cNum != 0){
rem = cNum % 10;
rev = rev * 10 + rem;
cNum /= 10;
}
if(num == rev){
printf("Palindrome");
}
else{
printf("Not Palindrome");
}
}
/*
Palindrome number in c: A palindrome number is a number that is same after
reverse. For example 121, 34543, 343, 131, 48984 are the palindrome numbers.
*/
#include<stdio.h>
int main()
{
int n,r,sum=0,temp;
printf("enter the number=");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
printf("palindrome number ");
else
printf("not palindrome");
return 0;
}