Friday 3 February 2012

Check the given number is palindrome number or not using c program


Code 1:

1. Wap to check a number is palindrome

2. C program to find whether a number is
palindrome or not



#include

int main(){

    int num,r,sum=0,temp;



    printf("Enter a
number: ");

    scanf("%d",&num);



    temp=num;

    while(num){

         r=num%10;

         num=num/10;

         sum=sum*10+r;

    }

    if(temp==sum)

         printf("%d is a palindrome",temp);

No comments:

Post a Comment