Tuesday, 7 April 2015

C Program to check whether given number is Palindrome or Not.

#include<stdio.h>
#include<conio.h>
main()
{
                int n,n1,sum=0;
                clrscr();
                printf("Enter the number\n");
                scanf("%d",&n);
                n1=n;
                while(n>0)
                 {
                                sum=sum*10+n%10;
                                n=n/10;
                }
                if(n1==sum)
                {
                                printf("\n%d is a Pallindrome number.",n1);
                }
                else
                {
                                printf("\n%d is not an Pallindrome number.",n1);
                }
}

No comments:

Post a Comment