programming-examples/perl/Datatype/Math calculation on integer.pl

29 lines
734 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!C:\Perl\Bin\
$number_one = 5;
$number_two = 3;
print "Adding numbers:\n";
$result = $number_one + $number_two;
print "5 + 3 = $result \n\n";
print "Subtracting numbers:\n";
$result = $number_one - $number_two;
print "5 - 3 = $result \n\n";
print "Multiplying numbers:\n";
$result = $number_one * $number_two;
print "5 * 3 = $result \n\n";
print "Dividing numbers:\n";
$result = $number_one / $number_two;
print "5 / 3 = $result \n\n";
print "Raising numbers to a power:\n";
$result = $number_one ** $number_two;
print "5 raised to the power of 3 is $result \n\n";
print "Obtaining a remainder after a division (Modulo):\n";
$result = $number_one % $number_two;
print "5 Modulo 3 is $result \n\n";