Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Created November 30, 2014 19:52
Show Gist options
  • Select an option

  • Save nikAizuddin/cf878984cb34fad2539a to your computer and use it in GitHub Desktop.

Select an option

Save nikAizuddin/cf878984cb34fad2539a to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (PERL)
#!/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