Algorithm to find whether the given number is palindrome or not
Answers
Algorithm to check whether a number is palindrome or not
C Program to Check Whether a Number is Palindrome or Not. This program reverses an integer (entered by the user) using while loop. Then, if statement is used to check whether the reversed number is equal to the original number or not.
include <stdio.h>
int main()
{
int n, reversedNumber = 0, remainder, copy;
printf("Enter an integer: ");
scanf("%d", &n);
copy = n;
while(n != 0)
{
remainder = n%10;
reversedNumber = reversedNumber*10 + remainder;
n /= 10;
}
printf("Reversed Number = %d", reversedNumber);
if (copy == n)
cout << "It is a palindrome";
else
cout << "It is not a palindrome";
return 0;
}
Hope this helps you!
Mark as brainliest!