#!/usr/bin/perl # # Name : Matthew Reeves # # Handles some basic arithmetic operations # #use diagnostics; use warnings; use strict; #section prompts for user input for the three integers, stores each as scalar print "\nPlease enter the first integer: "; chomp (my $num1 = <>); print "Please enter the second integer: "; chomp (my $num2 = <>); print "Please enter the third integer: "; chomp (my $num3 = <>); #calculates, and prints out the sum of the three numbers printf("SUM: %d\n", $num1+$num2+$num3); #calculates, and prints out the average of the three numbers printf("AVG: %f\n", ($num1+$num2+$num3)/3); #calculates, and prints out the product of the three numbers printf("PRO: %d\n", $num1*$num2*$num3); #initialize variable to hold smallest integer, initally set as $num1 value my $small = $num1; #check if num2 is smaller $small = $num2 if $num2 < $small; #check if num3 is smaller $small = $num3 if $num3 < $small; #initialize variable to hold largest integer, initally set as $num1 value my $large = $num1; #check if num2 is larger $large = $num2 if $num2 > $large; #check if num3 is larger $large = $num3 if $num3 > $large; #print largest and smallest integers to screen print "SML: $small\nLRG: $large\n\n";