Monday, March 26, 2012

Program to check whether a given number is palindrome or not


/*****************<soeasyprograms.blogspot.in>******************/
/*Program to check whether a given number is palindrome or not*/
#include<stdio.h>
#include<conio.h>
void main()
{
                     int n,num,rem,rev=0;
                     clrscr();
                     printf("Enter a number \n");
                     scanf("%d",&num);
                     n=num;
                     while(n>0)
                     {
                       rem=n%10;
                       rev=(rev*10)+rem;
                       n=n/10;
                     }
                    if(rev==num)
                    {
                     printf(" Entered number is palindrome");
                    }
                    else
                   {
                    printf("Entered number is not palindrome");
                   }
                 getch();
}
/*****************<soeasyprograms.blogspot.in>******************/




                 /*End of program*/

No comments:

Post a Comment