TASK 3-
A five-digit number is entered through the keyboard. Write a
C-program to obtain the reversed number and to determine whether the original
and reversed numbers are equal or not.
CODE:
#include<stdio.h>
int digit(int x);
int main(){
int x,r;
printf("Enter
the number: ");
scanf("%d",&x);
r=digit(x);
if (r==x)
printf("\nreverse of the number is same as original");
else
printf("\nreverse of the number is not same as original");
getchar();
return 0;
}
int digit(int x)
{
static int d,sum=0;
if (x>0)
{
d=x%10;
sum=(sum*10)+d;
x/=10;
digit(x);
}
return sum;
}
OUTPUT: