in reply to finding multiples of two values
I think JavaFan had it right but I didn't notice, since his reply didn't have code, till I wrote some. So…
while ( <DATA> ) { chomp; my ( $first, $second ) = split; print "$first:$second --> ", multiple($first,$second) ? "yes" : "no", "\n"; } sub multiple { my ( $one, $two ) = @_; ! ( $one > $two ? $one % $two : $two % $one ); } __DATA__ 1 2 2 3 3 9 9 3 11 7 2 108 4 4
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: finding multiples of two values
by urnumdei (Initiate) on Sep 02, 2009 at 10:14 UTC |