VB icon

Range of Fibonacci Numbers in PHP

Email
Submitted on: 9/3/2016 2:01:19 AM
By: Jake R. Pomperada  
Level: Beginner
User Rating: By 1 Users
Compatibility: PHP 3.0, PHP 4.0, PHP 5.0
Views: 1519
author picture
 
     A simple program that I wrote using PHP that will ask the user to give a range from lower bound to upper bound and then our program will generate a series of fibonacci number based on the range that is being specify by our user. Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Range of Fibonacci Numbers in PHP
// Description:A simple program that I wrote using PHP that will ask the user to give a range from lower bound to upper bound and then our program will generate a series of fibonacci number based on the range that is being specify by our user.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
 
My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************

<html>
	<head>
	<title>
	 Range of Fibonacci Numbers
	 </title>
 </head>
	<style>
	body {
	 font-family:arial;
	 font-size :20px;
	 background-color:lightgreen;	
}
input[type=submit]
	{
font-size: 20px; 
font-weight: bold;
font-family: arial; 
background-color: lightblue;
	}
	</style>
<body>
 <?php
 error_reporting(0);		
 $a=$_POST['lower'];
 $b=$_POST['upper'];	
 if(isset($_POST['clear']))
{
$a="";
$b="";
$fib3="";
}	
 ?>		
			<BR>
<h3>Range in Fibonacci Numbers</h3>
<form method="post" action="index.php" name="prime_me">
Lower Bound   <input type="text" name="lower" 
	 size="5" value="<?php echo $a; ?>" autofocus>
     	 	 
Upper Upper Bound   <input type="text" name="upper" 
	 size="5" value="<?php echo $b; ?>">
<br><br>
<input type="submit" name="check" value="Ok">
     	 	 	
<input type="submit" name="clear" value="Clear">
</form>
	<h3> DISPLAY RESULTS </h3>
<?php
if(isset($_POST['check']))
{
$fib1=0;
$fib2=1;
$fib3=0;
$a=$_POST['lower'];
$b=$_POST['upper'];
	for($i=$a;$i<$b;$i++)
 {
if ($fib3<=$b)
{
if ($fib3>=$a)
{
echo " " .$fib3." ";
}
$fib1=$fib2;
$fib2=$fib3;
$fib3=$fib1+$fib2;
}
 }
}
?>
</body>
</html>


Other 46 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.