Search for '{{search_term}}'

Exercise: Sum of numbers in a file

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

Let's implement something slightly useful.

In this exercise we have a file called numbers.txt that has numbers in it. Each line is a number.

Our aim is to add the numbers and print the result.

examples/data/numbers.txt

3
7
23
-17
98
12

Expected result is 126.

Tools

Some of the tools you might need to solve this exercise.

Solutions

Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus