Showing posts with label multiply of two numbers in perl. Show all posts
Showing posts with label multiply of two numbers in perl. Show all posts

Friday, August 19, 2016

Product of Two Numbers in PERL CGI

A simple program that I wrote that will ask the user to give two numbers and then our program will find the product of the two numbers using PERL CGI.


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




Sample Program Output

Program Listing

 product.cgi


#!"D:\xampp\perl\bin\perl.exe"
use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
my $q = new CGI;

my $num1 = $q->param(val1);
my $num2 = $q->param(val2);
print "Content-type: text/html\n\n";

print "<html>
<style>
body {
     font-family:arial;
     font-size:15;
     color:blue;
    }

</style>
<head><title>Product of Two Numbers in Perl CGI</title></head>
<body bgcolor='lightgreen'>
    <h3>Product of Two Numbers in PERL CGI</h3>
    <b>Written By: Mr. Jake R. Pomperada,MAED-IT</b>
    <br><br>
    <form action='' method='post'>
        <label>Enter First Number <label>
        <input type='text' name='val1' value='' autofocus/><br><br>
        <label>Enter Second Number  </label>
        <input type='text' name='val2' value='' />
        <br><br>
        <input type='submit' value='Submit' />
   
    <input type='reset' name='Reset' value='Reset'/></form>
</body>
</html>";   


if($q->param())
{
   
 
    $product = $num1 * $num2;
   
        print "<p>The product of $num1 and $num2 is $product.</p>";
   
}