use strict; use warnings; use 5.016; my $n = $ARGV[0] or die "Give a damn! Give a number."; require List::Util; say List::Util::sum( 1 .. $n );
In reply to Re: How do I write a program that calculates the sum of all numbers to a number, n?
by Anonymous Monk
in thread How do I write a program that calculates the sum of all numbers to a number, n?
by fmny94
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |