Code

<!DOCTYPE html>
<html>
<head>
<title>SYMBOL PYRAMID</title>
</head>
<body>
<h2>SYMBOL PYRAMID</h2>
<?php
if(isset($_POST["Submit"]))
{
$val = $_POST["val"];
$symbol = $_POST["symbol"];
}
else if(isset($_POST["clear"]))
{
$val = "";
$symbol = "";
}
else 
{
$val = "";
$symbol = "";
}?>
<form method="POST">
Enter the loop Number <input type="text" name="val" value="<?php echo"$val"; ?>" />
</br>
Enter the Symbol <input type="text" name="symbol" value="<?php echo"$symbol"; ?>"/>
</br>
<input type="submit" name="Submit" value="Submit">

<input type="submit" name="clear" value="Reset" >
</form>

<?php  
if($val and $symbol)
{
if(is_numeric($val))
{	for($i=1;$i<=$val;$i++)
	{         
		for($j=1;$j<=$i;$j++)
		{      
			echo "&nbsp ".$symbol;
		}	
	echo "<br />";
	}
}
else
	{
	 echo "Enter loop in Digits";
	}
}    
?>
</body>
</html>

Output

 

PYRAMID Output
PYRAMID Output

Make Own Pyramid

Enter the loop Number
Enter the Symbol
(Visited 878 times, 1 visits today)
Share with Friends :
Written by: