Skip to content

Instantly share code, notes, and snippets.

@FloydHsiu
Created November 12, 2016 04:38
Show Gist options
  • Save FloydHsiu/cb700843c6798f50fc5aef04ed225b61 to your computer and use it in GitHub Desktop.
Save FloydHsiu/cb700843c6798f50fc5aef04ed225b61 to your computer and use it in GitHub Desktop.
sum=input;
for(count=1;count<=10;count++)//反向相加的次數以10為上限(這裡開始好像怪怪的)
{
reverse = 0;
temp=sum;
while(temp)
{
reverse=reverse*10+temp%10;
temp/=10;
}
sum = sum + reverse;
if(ispalindromic(sum)){
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment