A number is a number that remains the same when its digits are reversed. For example, 15451 is a palindrome number.
Flowchart
Program
#include <stdio.h>
#include <conio.h>
void main()
{
int n, temp, rev = 0, r;
printf("enter a number: ");
scanf("%d", &n);
temp = n;
while (temp > 0)
{
r = temp % 10; // taking reminders
rev = (rev * 10) + r; // storing the value of r in rev
temp = temp / 10; // dividing remaining numbers
}
if (n == rev)
{
printf("%d is Palindrome Number\n", rev);
}
else
{
printf("%d is not a Palindrome Number \n", rev);
}
getch();
}
OUTPUT
Enter a number: 47
74 is not a Palindrome Number.
Enter a number: 147741
147741 is the Palindrome Number.
0 Comments