PREE HW#4 - HW#4 1.1 #!/usr/local/bin/perl -w Tzu-Ying...

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

View Full Document Right Arrow Icon
HW#4 Tzu-Ying Hsu(9083) 1.1 #!/usr/local/bin/perl -w #This profram print the smaller of two numbers. print ("Enter the first number: "); $num1 = <STDIN>; print ("Enter the second number: "); $num2 = <STDIN>; if ($num1 < $num2) { print ("The smaller number is: ",$num1,"\n"); } else { print ("The smaller number is: ",$num2,"\n"); } #End of the program 1.2 #!/usr/local/bin/perl -w #This program prints the smaller of two strings. print ("Enter the first string: "); $str1 = <STDIN>; print ("Enter the second string: "); $str2 = <STDIN>; if ($str1 le $str2) { print("The smaller string is: ", $str1, "\n"); } else { print("The smaller string is: ", $str2, "\n"); } #End of the program 1.3 #!/usr/local/bin/perl -w # This program changes a numberic grade to a letter grade print ("Please enter the numeric grade: ");
Background image of page 1

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

View Full DocumentRight Arrow Icon
chomp ($numGrd = <STDIN>); if($numGrd >= 90) { $lettGrd = "A"; } elsif($numGrd >= 80) { $lettGrd = "B"; } elsif($numGrd >= 70) { $lettGrd = "C"; } elsif($numGrd >= 60) { $lettGrd = "D";
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.

This note was uploaded on 12/11/2010 for the course MSEE 1 taught by Professor Alex during the Spring '10 term at Northwestern Polytechnic University.

Page1 / 5

PREE HW#4 - HW#4 1.1 #!/usr/local/bin/perl -w Tzu-Ying...

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