ads

Sunday, 28 August 2016

c program to check the number is palindrome or not

#include <stdio.h>
#include <conio.h> 
void main()
{
   int num,rev= 0,num1;
   printf("Enter a number to check if it is a palindrome or not\n");
   scanf("%d",&num);
   num1 = num;
   while( num != 0 )
   {
      digit=num%10;
      rev=rev*10+digit;
      num=num/10;
   }
   if ( num1 == rev )
   printf("%d is a palindrome number.\n", n);
   else
   printf("%d is not a palindrome number.\n", n);
   getch();
}

No comments:

Post a Comment