We have to implement an algorithm to check the number is palindrone or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main(){ | |
int n,r,res=0,a; | |
printf("ENter a number : "); | |
scanf("%d",&n); | |
a=n; | |
while(n!=0){ | |
r=n%10; | |
res=res*10+r;//321 | |
n=n/10; | |
} | |
printf("reverse is : %d\n",res); | |
if(a==res){ | |
printf("palindrome"); | |
} else{ | |
printf("not a palindrome"); | |
} | |
return 0; | |
} |
1 Comments
Thanks for such a great work
ReplyDeletePython Online Training