int main(int argc, const char * argv[]) {
int n=123,temp,r,rev=0;
temp=n;
while (temp>0) {
r=temp%10;
rev=(rev*10)+r;
temp=temp/10;
}
NSLog(@"%i",rev);
if (n==rev) {
NSLog(@"palindrome");
} else {
NSLog(@"not palidrome");
}
return 0;
}
Sign up here with your email
ConversionConversion EmoticonEmoticon