Sunday, September 2, 2012

Check Palindrome Number from given Input Integer C program

Check Palindrome Number from given Input Integer C program

This program use to check given input integer is palindrome or not. Simple just reversing and storing digit to sum then compare it with back one!


/* Program For To Palindrome No. */
#include<stdio.h>
#include<math.h>

int main()
{
int no,rem;
printf("\nEnter no\n");
scanf("%d",&no);
int bs=no;
int sum=0;
while(no)
{
rem=no%10;
sum=sum*10+rem;
no=no/10;
}

if(bs==sum)
 printf("No  %d is Palindrome No.\n",bs);
else
 printf("\nNo %d is not a Palindrome.....!\n",bs);
return 0;


}

0 comments:

Post a Comment