Write a C Program that reverse a given integer number and check whether the number is palindrome or not.

#include<stdio.h>
#include<conio.h>
main()
{
    int n,temp=0,t,rev=0;
    clrscr();
    printf("Enter the number\n");
    scanf("%d",&n);
    temp=n;
    while(n!=0)
    {
    t=n%10;
    rev=rev*10+t;
    n=n/10;
    }
    if(temp==rev)
    printf("Its a palindrome");
    else
    printf("Its not a palindrome");
    getch();
    return 0;
}

2 comments: