C program to reverse a number and check whether it is palindrome or not?

#include<stdio.h>

int main()
{
    int num, rev = 0,t;    
    printf("Enter a number to reverse\n");    
    scanf("%d",&num);
    t=num;
    while (num!=0)
    {
        rev = (rev*10)+(num%10);
        num = num/10;
    }

    printf("Reverse of entered number is = %d\n", rev);    
  	if (t==rev)
	   printf("\nIt is a Palindrome");
	else
	   printf("\nIt is not a Palindrome");
}

Advertisements

#c