DeveloperBreeze

Generate the Fibonacci series

$n = 10;
$a = 0;
$b = 1;
echo $a . ' ' . $b . ' ';
for ($i = 2; $i < $n; $i++) {
    $c = $a + $b;
    echo $c . ' ';
    $a = $b;
    $b = $c;
}

Related Posts

More content you might like

Tutorial
javascript

Variables and Constants

  • Used for variables whose value should not change.
  • Example:
     const PI = 3.14;
     console.log(PI); // 3.14

Dec 10, 2024
Read More
Code
javascript

JavaScript Prime Number Check

No preview available for this content.

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!