Generation

generate functionMon, 05 Dec 2022

Write a program to check whether a number is palindrome number or not

int reverse(int n) { int i,a=0; for(i=n;i>0;i=i/10) { a=a*10+i%10; } return a; } int main() { int num,a; printf("\n Enter a number:"); scanf("%d",&num); a=reverse(num); if(a==num) printf("\n The number is palindrome"); else printf("\n The number is not palindrome"); return 0; }

Questions about programming?Chat with your personal AI assistant