I need some help with Perl programming

Asked By 0 points N/A Posted on -
qa-featured

Hi guys,I need some help to write a Perl program that reads three numbers from the keyboard and displays the sum,product and average of the three numbers,please would you kindly help me

SHARE
Answered By 0 points N/A #93595

I need some help with Perl programming

qa-featured

This is easy.Please follow the instruction,I am providing you with the program-

print qq{Please enter the first number: n};
$number_1 = <STDIN>;
chomp $number_1;

print qq{Please enter the second number: n};
$number_2 = <STDIN>;
chomp $number_2;

print qq{Please enter the third number: n};
$number_3 = <STDIN>;
chomp $number_3;

while (!($number_1 == 0 && $number_2 == 0 && $number_3 == 0 ))
{

   $sum = $number_1 + $number_2 + $number_3;
   $product = $number_1 * $number_2* $number_3;
   $average = $sum / 3;

if($sum > 200)
{
   print qq{$sum, *, $product, $averagen};
}
else
{
   print qq{$sum, $product, $averagen}; 
}

Related Questions