Like Us Like Us Facebook Subscribe Subscribe us YouTube Whatsapp Share us Whatsapp Query Send your queries

Checking Given Integer is Palindrome or Not

Checking Given Integer is Palindrome or Not

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

############################
#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 .

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
annikaromyRamesh K Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Ramesh K
Guest

Thanks for sharing this informative information…You may also refer….
How to migrate from a typical HTML4 page to a typical HTML5 page.
http://www.s4techno.com/blog/2016/08/30/html5-migration/

annikaromy
Guest

The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .

Do you have any Query / Suggestion