Code In Tech - The Ultimate World of Computer Technology

Saturday, 24 March 2012

C Program to check whether the given number is Palindrome or not

SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
 long int n,temp,a,sum=0;
 clrscr();
 printf("Enter number:");
 scanf("%ld",&n);
 temp=n;
 while(n>0)

 {
  a=n%10;
  sum=sum*10+a;
  n/=10;
  }
  if(temp==sum)
  {
   printf("\n%ld is palindrom.",temp);
  }
  else
  {
   printf("\n%ld is not palingrom.",temp);
  }
 getch();
}

No comments :

Post a Comment