palindrome solution code example
Example 1: formula for finding a mathematical palindrome
how to check if a number is a palindrome or not
Example 2: palindrome
//made by Kashish Vaid the great.
// Palindrome programme using for loop the easiest prgm
#include <stdio.h>
int main() {
int n, rev = 0, remainder, num;
printf("Enter an integer: ");
scanf("%d", &n);
num = n;
// reversed integer is stored in rev
for(num = n ; n!=0 ; n/=10)
{
remainder = n%10;
rev = rev*10 + remainder;
}
// if else shortcuts
( (rev == num) ? printf("%d is a palindrome.", num) : printf("%d is not a palindrome.", num) );
return 0;
}
//made by Kashish Vaid the great.