Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Friday 6 January 2017

a php program to print any table

                         -------------------html code------------------
<html>
<center>
<head><title>table</title>
<style>
.button1 {
    background-color: white;
    color: blue;
    border: 3px dashed Green;
border-radius:12px;
padding:20px;
font-size:16px;
}
</style>
</head>
<p class="button1";>To Print table of any number</p>
<br><br><br><br><br><br>
<form action="table.php" method="post">

Enter the number :<input type="text"  name="number" >&nbsp;&nbsp;
<input type ="submit" class="button1 button" name="Calculate" value="Click" >


          ---------------------PHP code------------------------


<?php
$num=$_POST['number'];
if($num==0){echo "please enter a number";}
else
{
print("<center><h1><b><u>The table of $num is</u>--></b>");
echo "<br/>";
for($i=1;$i<=10;$i++)
{
print("$num * $i = ".$num *$i);
echo "<br/>" ;
}
}
?>

No comments:

Post a Comment