Все вопросы: [sum-of-digits]
3 вопросов
49
голосов
10ответов
30995 просмотров
Sum of digits of a factorial
Link to the original problem It's not a homework question. I just thought that someone might know a real solution to this problem. I was on a programming contest back in 2004, and there was this problem: Given n, find sum of digits of n!. n can be from 0 to 10000. Time limit: 1 second. I th...
0
голосов
3ответов
324 просмотров
My 'cout' isn't giving correct value - why?
Simple "sum of digits" code. It compiles but when executed, the last cout gives a "0" for the num int rather than the actual user-input number. Feel free to copy and paste this into your own compiler, if you're so inclined, to see what I mean. How can I get this to output the correct "num" val...
41
голосов
18ответов
85761 просмотров
Сумма цифр в C #
Какая реализация вычисления суммы цифр самая быстрая и легкая для чтения? Т.е. Учитывая число: 17463 = 1 + 7 + 4 + 6 + 3 = 21