I'm writing a very simplified program that finds all the factors of any number you input.
Here's how it goes:The problem is, it prints decimals as well as factors. Please help?print "Enter a number you want to factor: \n"; $number = <STDIN>; for ($count = 2; $count <=sprintf($number/2); $count++) { $result = $number / $count; { push (@factor, $result); } } print "The factors of $number are: \n"; foreach (@factor) { print "$_\n"; }
In reply to how to make perl only print whole numbers by derpp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |