Search across blog, articles, projects, courses, and community posts
Read a non-negative integer and print the sum of its decimal digits.
Input: one non-negative integer, possibly very large.
Output: the sum of its digits.
0 <= n <= 10^18. Treat the input as text: values this large can lose precision as numbers in JavaScript.
1234
10
999
27