#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int reverse(int n) {
int r = 0;
while (n > 0) {
r = r * 10 + (n % 10);
n /= 10;
}
return r;
}
int main() {
int a;
int r;
int sum;
int rSum;
int count = 0;
scanf("%d", &a);
while(1) {
count++;
r = reverse(a);
sum = a+r;
rSum = reverse(sum);
if(sum == rSum) break;
else a = sum;
}
printf("%d", count);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: