Computer Science, asked by mohapatratanushree34, 9 months ago

Write a program to print first 15 terms of fibonacci series 0 1 1 2 3 5 8 13 ...​

Answers

Answered by 13579rishikeshpandit
2

Answer:

// C++ program to print first n Fibonacci numbers

#include <bits/stdc++.h>

using namespace std;

// Function to print first n Fibonacci Numbers

void printFibonacciNumbers(int n)

{

int f1 = 0, f2 = 1, i;

if (n < 1)

return;

for (i = 1; i <= n; i++)

{

cout<<f2<<" ";

int next = f1 + f2;

f1 = f2;

f2 = next;

}

}

// Driver Code

int main()

{

printFibonacciNumbers(7);

return 0;

}

Answered by lydiadian
0

hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiExplanation neaded

Similar questions