Just do it in a slightly more complicated manner than is strictly necessary...
#!/usr/bin/perl use strict; use warnings; use feature qw/say/; while(my $n = shift @ARGV) { say grep { $n == $_ } map { $n += $_ } map { $n-- } map { ($n) x $_ } $n ;}
In reply to Re: How do I write a program that calculates the sum of all numbers to a number, n?
by AppleFritter
in thread How do I write a program that calculates the sum of all numbers to a number, n?
by fmny94
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |