practical 4 ( Nesting Function )

 

Practical No.4

Aim: Write a PHP program to find the largest values of two numbers using  Nesting Function.

Program: Html Filename: Nesting of function

<html>

<body>

<form action=""method="post">

<br><center><h1><u>Nesting fuction</u></h1></center>

<br><table bgcolor="yellow" align="center">

<tr><td><br><input type="text" value=" Enter 1st value" readonly>

<input type="text" name="f"></tr></td>

<tr><td><br><input type="text" value=" Enter 2nd value" readonly>

<input type="text" name="s"></tr></td>

<tr><td><br><br><center><br><br>

<input type="submit"value="&nbsp;&nbsp; SUBMIT &nbsp;&nbsp;">

<br><br><br></center></tr></td></table

</form>

<?php

if($_POST)

{

$a=$_POST["f"];

$b=$_POST["s"];

function big($a,$b)

{

               if($a>$b)

                              return$a;

               else

                              return$b;

               }

               function large($a,$b)

               {

                              $n=big($a,$b);

echo'<br><br><table align="center" border="4"><tr align="center"><td>';

echo'<h1><font color="blue">Nesting function</font></h1>';

echo"<b><u>given value:</u></b><br><br>First value =$a";

echo "<br>Second value=$b";

echo'<br><h3><font color="darked"face="white">large value=';

echo" $n</font></h3></td></tr></table>";

 

                              }

                              large($a,$b);

               }?>

                                            

</body>

</html>




Comments

Popular posts from this blog

Practical No.1

Practical 8 ( Recursive Function. )