Skip to content

Instantly share code, notes, and snippets.

@josefsalyer
Created November 29, 2011 19:04
Show Gist options
  • Save josefsalyer/1405978 to your computer and use it in GitHub Desktop.
Save josefsalyer/1405978 to your computer and use it in GitHub Desktop.
Sum of numbers

Sum of Digits

Description:

Given a positive integer, find the sum of its constituent digits.

Input sample:

The first argument will be a text file containing positive integers, one per line. e.g.

23
496

Output sample:

Print to stdout or log, the sum of the numbers that make up the integer, one per line. e.g.

5
19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment