Talk:Sum digits of an integer: Difference between revisions
m
fix silly typo
m (fix silly typo) |
|||
Line 6:
::I don't understand. "SumDigits(0xfe, 10) would return 11 and that SumDigits(254, 16) would return 29." if sumDigits(0xfe, 16) -> 29<sub>10</sub>, then how would sumDigits(256, 16) -> 29<sub>10</sub>? Shouldn't it return 13<sub>10</sub>? --[[User:La Longue Carabine|La Longue Carabine]] 16:19, 23 July 2012 (UTC)
:::254 in base 16 has the digits with decimal values 15 and 14. Their sum when expressed in decimal notation is 29. In base 16, using hexadecimal digits, this sum might be represented as 1b = f + e. But we should get a different value for the sum of the digits of 256 -- in base 16, the digits have decimal values 1, 0 and
|