Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub factorial {
- my $n = shift;
- return 1 if $n == 0;
- return $n * factorial($n - 1);
- }
- print "Masukkan bilangan: ";
- my $input = <STDIN>;
- chomp($input);
- my $result = factorial($input);
- print "Faktorial dari $input adalah $result\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement