palindrome meaing code example
Example 1: 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.
Example 2: palindrome
function isPalindrome(text) {
return [...text].reverse().join('') === text;
}
isPalindrome = text => {
return [...text].reverse().join('') === text;
}
isPalindrome = text => [...text].reverse().join('') === text;