Sum of digits in a number

Sum of digits in a number

Write an application that prompts for and reads a number then prints the sum of the digits comprising that number.

Example 1:


input data:
150
output:
6

Example 2:


input data:
23
output:
5
View Java Solution

Seda
Seda Kunda is a web designer and developer with a degree in Computer Science and a great passion for code. Besides code, she enjoys pepperoni pizza, watching the bachelor and sleeping in on Saturdays.
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn