Is Palindrome Number
This algorithm check whether a given number is palindrome number or not. A palindrome number is a number such that if we reverse it, it will not change.
/*****Please include following header files*****/
// stdbool.h
/***********************************************/
int Reverse(int num) {
int reverse = 0;
while (num != 0)
{
reverse *= 10;
reverse += num % 10;
num /= 10;
}
return reverse;
}
bool IsPalindromeNumber(int num) {
return num == Reverse(num);
}
Example
bool isPalindromeNumber = IsPalindromeNumber(-4554);
Output
true