Previous Post: Next Post: C #3-Palindrome or not String using C Program C #5-Reversing of number using C Program.
Palindrome of Number :
Palindrome of Number :
Palindrome of a number is defined as a number to be same as when it is read from back and fro remains to be same...then those numbers are called palindrome numbers..
Source Code:
#include<stdio.h>
void main()
{
int r, sum=0, temp;
int n;
printf("Enter the number to Check:");
scanf("%d", &n);
temp = n;
while (n>0)
{
r = n % 10;
sum = (sum*10)+r;
n = n / 10;
}
if (temp == sum)
{
printf("The number is Palindrome");
}
else
{
printf("The number is not Palindrome");
}
}
Output:
Enter the number to check: 454
The number is Palindrome
Thanks and regards,
Tech Bird
Comments