PREE HW#3 - HW#3 Tzu-Ying Hsu(9083) 1-1....

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
HW#3 Tzu-Ying Hsu(9083) 1-1. #!/usr/local/bin/perl -W # This program shows the use of mathematicaal operators. $a = 13; $b = 4; $c = 5; $res1 = $a + 4; $res2 = $a - 4; $res3 = $a * 4; $res4 = int($a / $b); $res5 = $a % $b; $res6 = $c ** 2; print ("$a + 4 = $res1\n"); print ("$a - 4 = $res2\n"); print ("$a * 4 = $res3\n"); print ("$a / $b = $res4\n"); print ("$a % $b = $res5\n"); print ("$c ** 2 = $res6\n"); #end of pgm 1-2. #!/usr/local/bin/perl -w # This program shows the use of mathematical operators $a = 13.7; $b = 4.4; $c = 5.2; $res1 = $a + 4; $res2 = $a - 4; $res3 = $a * 4; $res4 = $a / $b; $res5 = $a % $b; $res6 = $c ** 2; print ("$a + 4 is $res1\n"); print ("$a - 4 is $res2\n"); print ("$a * 4 is $res3\n"); print ("$a / $b is $res4\n"); print ("$a % $b is $res5\n"); print ("$c ** 2 is $res6\n"); # End of the program 1-3. #!/usr/local/bin/perl -w #This program shows the average of four numbers.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
print ("Enter the first number:23 \n"); $num1 = 23; print ("Enter the second number:56 \n");
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

PREE HW#3 - HW#3 Tzu-Ying Hsu(9083) 1-1....

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online