According to wikipedia.org A Palindrome is a word, phrase, number, or
other sequence of characters which reads the same backward or forward.
Allowances may be made for adjustments to capital letters, punctuation,
and word dividers. So I am going to to show how to check whether a given integer is Palindrome or Not using C.Environment:
OS- Linux (kubuntu 16.04)
Compiler – GCC
IDE -Codeblock
other sequence of characters which reads the same backward or forward.
Allowances may be made for adjustments to capital letters, punctuation,
and word dividers. So I am going to to show how to check whether a given integer is Palindrome or Not using C.Environment:
OS- Linux (kubuntu 16.04)
Compiler – GCC
IDE -Codeblock
include <stdio.h> /* To check if a string is a palindrome or not, a string needs to be compared with the reverse of itself. */ int main(){ int n; int reverseno = 0; int remainder; int originalno; printf("Please enter a integer :"); scanf("%d",&n); originalno = n; while(n!=0){ remainder= n%10; reverseno= reverseno *10 +remainder; n/=10; } if(originalno == reverseno) printf("%d is a palindrome.", originalno); else printf("%d is not a palindrome.", originalno); return 0; }
Screen shot :
You can do it palindrome check in any language like PHP, Javascript, Python, Ruby , Java , just change the code little bit .