We're a place where coders share, stay up-to-date and grow their careers.
Why aren't you adding the square of n to the sum?
I'm dividing n into it's digits (so 19 becomes 1 and 9) and then adding the square of those numbers to the sum.
Yeah I got that, but I don't see sum += n*n anywhere
The line 'sum += e * e' is what sums the digits
Ahh, I missed the while loop there. Oops
Why aren't you adding the square of n to the sum?
I'm dividing n into it's digits (so 19 becomes 1 and 9) and then adding the square of those numbers to the sum.
Yeah I got that, but I don't see sum += n*n anywhere
The line 'sum += e * e' is what sums the digits
Ahh, I missed the while loop there. Oops