/*A program to check weather the number is palindrome or not*/
#include<stdio.h>
int main()
{
int n,rev=0,x,num;
printf("Enter the number");
scanf("%d",&n);
num=n;
while(n>0)
{
x=n%10;
rev=rev*10+x;
n=n/10;
}
if(num==rev)
printf("%d is a palindrome number",num);
else
printf("%d is not a palindrome number",num);
return 0;
}
OUTPUT:
What is palindrome number?
Palindrome number are those numbers that remains the same when its digits are reversed.
Example:232,454,787,555 etc.
DESCRIPTION:
In this program first of all we ask the user to input a number and using the loop we reverse the number and check weather the reversed number and user input number is same or not and the output is displayed.
Try it yourself
Write a program to reverse the user input number.

No comments:
Post a Comment
If you have any doubt, please ask in the comment section.