Program :-
#include <stdio.h>
main(){
int temp, num ,rev,rem;
printf("enter the number : ");
scanf("%d",&num);
temp = num;
for(rev = 0 ; num > 0 ; num = num /10)
{
rem = num % 10;
rev = rev * 10 + rem ;
}
if ( rev == temp)
printf("\n number is palindrome");
else
printf("\n number is not palindrome");
}
Output:-
enter the number
121
number is palindrome
No comments:
Post a Comment