Code Competitions

Coding competition

Sunday, 12 May 2013

Program to check the number is palindrome or not?

#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,rev=0;
    printf("enter the number");
    scanf("%d",&a);
    c=a;
    while(a>0)
    {
        b=a%10;
        a=a/10;
        rev=rev*10+b;
    }
    if(c==rev)
    {
        printf("\n number is palindrome");
    }
    else
    {
        printf("\n number is not a palindrome");
    }
    getche();
}

No comments:

Post a Comment