john83reuben has asked for the wisdom of the Perl Monks concerning the following question:
#!usr/bin/perl
print "Enter temperature in Fahrenheit";
$temp=<STDIN>;
chomp $temp;
$newtemp =((($temp-32)*5)/int(9));
print "Temperature in Celsius is $newtemp\n";
if i enter 75 fahrenheit, the answer is23.8888888888889
. How can i print the amount with no more than 2 decimal
places without using printf and sprintf.
thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl newbie question
by bobf (Monsignor) on Jan 06, 2008 at 06:07 UTC | |
|
Re: perl newbie question
by derby (Abbot) on Jan 06, 2008 at 05:57 UTC | |
by dsheroh (Monsignor) on Jan 06, 2008 at 17:06 UTC | |
|
Re: perl newbie question
by downer (Monk) on Jan 06, 2008 at 15:04 UTC | |
by WoodyWeaver (Monk) on Jan 06, 2008 at 17:09 UTC |