Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You are trying to declare an int variable with a double value, which obviously won't work.
However, in this case it works, because compilator knows that the type of sum variable is int and it just casts it to int. Since the result of pow is an integer (double), nothing special happens, but if the result were a non-integer, then the decimal part of the method's result would be truncated (100.18 would be 100, 11.254 would be 11, 1.0 would be 1, and so on, and so on...).
I know this comment is 7 months old, but I wanted to clear it up.
That is correct, why does this code work. It shouldn't at all.
This comment is hidden because it contains spoiler information about the solution
Look through the solutions and you'll find a way shorter solution :D
This answer is so short xD
This comment is hidden because it contains spoiler information about the solution
Omg... this answer is so beautiful!