This website completely moved to new platform. For latest content, visit

Search this Site

15 Aug 2012

C Program To Find The Number Palindrome or Not

/* To Find Whether Number is Palindrome or Not */
void main()
    int num,rem,sum=0,temp;
    printf("\n /** To Find Reverse Of a Number **/ \n");
    printf("\n Enter a number: ");
     rem=num%10;  //for getting remainder by dividing with 10
     num=num/10; //for getting quotient by dividing with 10
     sum=sum*10+rem; /*multiplying the sum with 10 and adding
    printf("\n The Reversed Number is: %d \n",sum);
    if(temp==sum) //checking whether the reversed number is
                    equal to entered number
      printf("\n Number is Palindrome \n\n" );
      printf("\n Number is not a palindrome \n\n");
    return 0;

Sample Output:( using GNU GCC Compiler with code::blocks IDE, hence no need of clrscr(); and getch(); )

No comments:

Post a Comment

Thanks for your comments.