I know the best solution should be one line of code: return (num==0)? 0 : ((num - 1) % 9 + 1);

but just curious, what's the complexity for the iterative solution as below?

```
public int addDigits(int num) {
int sum = 0;
while (num > 0) {
sum += num % 10;
sum = (sum % 10 + sum / 10);
num /= 10;
}
return sum;
}
```

Thanks!