Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
For some reason this brings back 1.00% instead of 100%. I know I could multiply 50 to have 100 and maybe go about that way but the number of questions may change so I need to find out their percentage from the number right to the number of total questions.my $percent = $answers_correct / 50; $percent = sprintf("%.2f", $percent); print "You scored $percent%";
What am I doing wrong?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: decimal isn't truncating
by jhourcle (Prior) on May 22, 2005 at 11:29 UTC | |
|
Re: decimal isn't truncating
by dave_the_m (Monsignor) on May 22, 2005 at 08:05 UTC | |
by Roger (Parson) on May 22, 2005 at 08:39 UTC |