#!/usr/bin/perl -w #Driver #program by James Park #last revision on friday, september 23rd. #purpose this program driver will call on the arithmetic.pm file to find and use the correct #functions use strict; use lib "."; use arithmetic; sub menu{ print"please choose an option from the menu below:"; print"1. use the greatest common devisor function."; print"2. use the least common multiple function."; my $m = ; print"enter the first number: "; my $a = ; print "enter the second number:"; my $b = ; if ($m = 1 ){ my $gcd; $gcd = arithmetic::gcd($a,$b); print "gcd of ($a,$b) = $gcd"; }else{ my $lcm; $lcm = arithmetic::lcm($a,$b); print "lcm of ($a,$b)= $lcm"; } } #### #arithmetic.pm #!/usr/bin/perl -w use strict; package arithmetic; sub gcd() { my ($a, $b) = @_; ($a,$b) = ($b,$a) if $a > $b; while ($a) { ($a, $b) = ($b % $a, $a); } return $b; } sub lcm { my ($a,$b)=@_; return $a*$b/&gcd($a,$b); } ]