Quantcast
Channel: Comunidad Underground Hispana
Viewing all articles
Browse latest Browse all 11602

[Perl] Ejemplo de Sucesion Fibonacci

$
0
0
Un simple ejemplo de la Sucesion Fibonacci en Perl.

El codigo :

Código:

# !usr/bin/perl
# Sucesion Fibonacci
# Coded By Doddy Hackman in the year 2014

head();

print "\n\n[+] Enter count : ";
chomp( my $cantidad = <stdin> );

print "\n";

my ( $uno, $dos ) = ( "0", "1" );

for my $num ( 0 .. $cantidad ) {
    print "[+] : " . $uno . "\n";
    my $final = $uno + $dos;
    $uno = $dos;
    $dos = $final;
}

copyright();
<stdin>;
exit(1);

# Functions

sub head {
    print "\n-- == Fibonacci Sequence == --\n";
}

sub copyright {
    print "\n\n-- == (C) Doddy Hackman 2014 == --\n";
}

# The End ?


Viewing all articles
Browse latest Browse all 11602

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>