Program Code:
int main()
{
int n,num,count=0,rev=0,rem;
printf("Enter the number\n");
scanf("%d",&n);
num=n;
while(num>0)
{
rem=num%10;
rev=rem+rev*10;
num=num/10;
count++;
}
if(count==5)
{
if(n==rev)
{
printf("This number is a palindrome number\n");
}
else
{
printf("This number is not a palindrome number\n");
}
}
else
{
printf("The given number not a five digit number\n");
}
return 0;
}
Hence, 11211(Before reversing)=11211(after reversing)
Input:
Enter the number
11211
Output:
This number is a palindrome number
Input:
Enter the number
121
Output:
The given number not a five digit number
Input:
Enter the number
33211
Output:
This number is not a palindrome number
No comments:
Post a Comment