C Program to Check Whether a Given Number is Palindrome Number or Not

#include<stdio.h>
#include<conio.h>

int main()
{
	 long int number, reverse=0, rem, original;
	 clrscr();
	 printf("Enter number: ");
	 scanf("%ld", &number);
	
	 original = number;
	 
	 // Finding Reverse
	 while(number!=0)
	 {
	  rem = number % 10;
	  reverse = reverse*10 + rem;
	  number = number/10;
	 }
	 
	 // Checking for Palindrome
	 if(original == reverse)
	 {
	  printf("%ld is PALINDROME.", original);
	 }
	 else
	 {
	  printf("%ld is NOT PALINDROME.", original);
	 }
	 
	 getch();
	 return(0);
}

Output 

Run 1:
-------------
Enter number: 12321 ↲
12321 is PALINDROME.

Run 2:
-------------
Enter number: 12345 ↲
12345 is NOT PALINDROME.

Leave a Reply

Your email address will not be published. Required fields are marked *

https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
https://atozonlinesolutions.com/wp-content/uploads/2017/03/logo_white.png
About
Products
Subscribe

If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

    Applauz

    As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

    Subscribe

    If you wish to receive our latest news in your email box, just subscribe to our newsletter. We won’t spam you, we promise!

      Applauz

      As the pioneer of the lean startup movement, APPLAUZ has dedicated it’s time to sharing effective business strategies that help new businesses and enterpreneurs put their money to work in the right way.

      Copyright by BOLD THEMES. All rights reserved.