#!/usr/bin/perl print "Content-type: text/html\n\n"; use strict; use POSIX qw( ceil floor ); my $num = 9998; my $string1=''; my $string2=''; my $string3=''; my $string4=''; my $first8 = floor($num/8000); my $a = ($first8*8000); if ($first8 > 0) { $string1 .="1st line has $first8 times 8000 = $a"; } else { $string1 .="1st line has nothing "; } print "$string1 <br>\n"; my $second8= $num - $a; $second8 = floor($second8/400); my $b = ($second8*400); if ($second8 > 0) { my $third8 = $num - $second8 - ($second8*400); $string2 .="2nd line has $second8 times 400 = $b"; } else { $string2 .= "2nd line has nothing"; } print "$string2 <br>\n"; my $third8= $num-$a-$b; $third8 = floor($third8/20); my $c = ($third8*20); if ($third8 > 0) { $string3 .="3rd line has $third8 times 20 = $c"; } else { $string3 .="3rd line has nothing"; } print "$string3 <br>\n"; my $cumulative = $num - $a - $b - $c; if ($cumulative > 1) { $string4.="4th line has 1 times all = $cumulative"; } else { $string4.= "NOTHING LEFT OVER "; } print "$string4<br>\n";
In reply to Base20 Blues by JimDuyer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |