This site uses cookies own and third. If you continue to browse consider to accept the use of cookies. OK More Info.

[Perl] Ejemplo de Sucesion Fibonacci

  • 0 Replies
  • 4123 Views

0 Members and 1 Guest are viewing this topic.

Offline BigBear

  • *
  • Underc0der
  • Posts: 541
  • Actividad:
    0%
  • Reputación 3
    • View Profile

[Perl] Ejemplo de Sucesion Fibonacci

  • on: December 05, 2014, 12:57:54 pm
Un simple ejemplo de la Sucesion Fibonacci en Perl.

El codigo :

Code: (perl) You are not allowed to view links. Register or Login
# !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 ?