Tuesday, July 15, 2008
It’s Hott in Herr
# by mice r.r.
# for Perl Programming
print “What is your beginning temperature in Farenheit?\n”;
chomp ($begint = <STDIN>);
print “What is your ending temperature in Farenheit?\n”;
chomp ($endingt = <STDIN>);
print “By what amount of degrees would you like to increment the temperature?\n”;
chomp ($incrementt = <STDIN>);
if ($begint < -459.69 || $endingt < -459.69) {
die “Sorry, your one of your temperatures is less than absolute zero which is physically impossible.\n”;
}
elsif ($begint > $endingt) {
die “Sorry, your beginning temperature is more than your ending temperature which is not permitted.\n”;
}
else {
print “Farenheit Celsius \n”;
while ($begint <= $endingt){
$celsiust = (($begint) -32) /1.8;
printf “%-7d\t”, $begint;
printf “%-7d\n”, $celsiust;
$begint = $begint + $incrementt;
}
}

output

temp

Aw Yeah.

Page 1 of 1 pages