Camelia
Prev: Read lines into array

Exercise: Print sum of numbers

Take a file that has one number on every line Print the sum of the numbers.

examples/numbers.txt
3
8
19
-7
13

The script should print 36.

Improve it to also print average, minimum and maximum.

Can you also think about way to print median and standard deviation?


Prev: Read lines into array

Table of Contents

Comments

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

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: