Perl program or script - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Perl program or script

princesst45princesst45 Posts: 2Member
OK, we were assigned to this assignment: Physicists tell us that the lowest possibel temperature is absolute zero. Absolute zero is-459.69
degrees Fahrenheit. a) Accept inputs from the user: a beginning temperature, an ending temperature and an increment value (all Fahrenheit) b)Check for bad input: a temperature less than zero and an ending message to STDERR if either condition is detected. c)Print a header showing "Fahrenheit Celcius". Print all the values from the beginning to the ending temperatures. Use a loop mechanism. The conversion formula is: C =(F - 32) / 1.8

#!/usr/local/bin/perl
printf "Please enter temperature(in Fahrenheit)
";
printf "Enter the beginning temperature
";
chomp($beg=);
printf "Enter the ending temperature
";
chomp ($end=);
printf "Enter the increment value
";
chomp($inc=);

if ($end < $beg)
{
printf STDERR "Beginning temperature can not be larger than ending temperature
";
}
if ($beg < -456.69 ||$end < -456.69)
{
printf STDERR "Temperature can not be below absolute zero
";
}
printf "Fahrenheit Celcius"
";

now how do I incorporate the loop for the beginning to ending temperatures to print the values is where I am stuck at
printf "$beg
";
printf "$end
";
Sign In or Register to comment.