Created
November 30, 2014 19:52
-
-
Save nikAizuddin/cf878984cb34fad2539a to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (PERL)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/perl | |
| # ========================================================== | |
| # This script requires user to input the name and last | |
| # semester GPA. The output of the script will display your | |
| # current CGPA (Assume that your current CGPA for 2 semester | |
| # is 3.5). | |
| # | |
| # Sample output will be: | |
| # | |
| # What is your name? | |
| # [User input] | |
| # What is your last semester GPA? | |
| # [User input] | |
| # Your CGPA is [Result] | |
| # | |
| # Round your answer in 2 dotted decimal | |
| # ========================================================== | |
| printf("What is your name?\n"); | |
| $name = <STDIN>; | |
| printf("What is your last semester GPA?\n"); | |
| $gpa = <STDIN>; | |
| $cgpa = 3.5; | |
| $cgpa = ($cgpa + $gpa) / 2.0; | |
| printf("Your CGPA is %.2f\n", $cgpa); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment