Saturday, September 3, 2016

Power of a Number Perl

A simple program that will ask the user to give the base and power of a number from the user using PERL as our programming language.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360
.


Program Listing

#!D:\xampp\perl\bin

sub solve_power {
    ($base1, $exponent) = @_;
    $solve  = $base1 ** $exponent;
}

print "\n\n";
print "Power of a Number";
print "\n\n";
print "Enter base number : ";
chomp($base=<>);
print "Enter power number (positive integer) : ";
chomp($exp=<>);
print "\n\n";
print "Display Result";
print "\n\n";
print "$base ^ $exp  = " ;
print  solve_power($base,$exp);
print "\n\n";
print "End of Program";
print "\n\n";

No comments:

Post a Comment