use strict;
use warnings;
# fibonacci sequence/series in Perl
my $cur = 1;
my $prev = 0;
my $i, my $tmp;
print $prev, " ";
for ($i = 0; $i < $ARGV[0]; $i++) {
print $cur, " ";
$tmp = $cur;
$cur += $prev;
$prev = $tmp;
}
use warnings;
# fibonacci sequence/series in Perl
my $cur = 1;
my $prev = 0;
my $i, my $tmp;
print $prev, " ";
for ($i = 0; $i < $ARGV[0]; $i++) {
print $cur, " ";
$tmp = $cur;
$cur += $prev;
$prev = $tmp;
}
No comments:
Post a Comment