HOME

Saturday, March 14, 2015

PROGRAM TO REVERSE NUMBER & CHECK WEATHER IT IS PALINDROME OR NOT.

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


No comments:

Post a Comment