Google+ PHP TUTORIALS ONLINE HELP FOR MEDICAL AND PROGRAMMING: Fibonacci series program in php

Wednesday 26 March 2014

Fibonacci series program in php

Fibonacci series program in php

// Fibonacci series program in php?.
 //In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation.
Example

<html>
<head>
<title>Fibonacci series program in php</title>
</head>
<body>

 <?php
  $count= 0;
 $x = 0;
 $y = 1;
 echo $x."<br/>";
 echo $y."<br/>";
 while($count<10){
 $z = $x + $y;
    echo $z."<br />";
    $x = $y;
    $y = $z;
    $count ++;
 }
?>
</body>
</html>
output:
0
1
1
2
3
5
8
13
21
34
55

89

No comments:

Post a Comment