Very simply square root finder

Very simply square root finder

The following code is a simple square root finder. this can be used as mathematical function for
/** SAVE THIS as square.php **/

<title>Square Root Finder</title>
<style>
body {background-color:#000000; font-family:verdana; font-size:8pt;}
table, tr, td {font-family:verdana; font-size:8pt; color:#ffffff;}
input {font-family:verdana; font-size:8pt; color:#ffffff; background-color:#000000; border-left:1px solid white; border-right:1px solid white; border-top:0px; border-bottom:0px; padding:2px;}
select, option {font-family:verdana; font-size:8pt; color:#ffffff; background-color:#000000; border:0px;}
</style>
<center>
<table border=0 style=”background-color:#000000; border:1px solid #ff0000; text-align:center;” cellspacing=0 cellpadding=3>
<tr><td style=”background-color:#000000; border:1px solid #ff0000; text-align:center;”>
<form action=square_out.php method=get>
Number 1: <input type=”text” name=”num1″ style=”border-top:1px solid white; border-bottom:1px solid white;”><br>
<input type=”submit” value=”Square Root It” style=”border:1px; solid white;”>
<input type=”reset” value=”Reset” style=”border:1px; solid white;”>
</form>
</table>
</center>

/** SAVE THIS as square_out.php **/

<?php
$a = $_GET[num1];
$b = sqrt($a);
$c = $b * $b;

echo “The square root of $a is $b”;
echo “<br>” . “<br>”;
echo “Check: $b times $b”;
echo “<br>”;
echo “Answer: $c”;
?>

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.