IDNLearn.com is your go-to platform for finding reliable answers quickly. Ask anything and receive immediate, well-informed answers from our dedicated community of experts.
Sagot :
Answer:
0+1=1
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
Explanation:
// 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;
cout << f1 << " ";
for (i = 1; i < n; i++) {
cout << f2 << " ";
int next = f1 + f2;
f1 = f2;
f2 = next;
}
}
// Driver Code
int main()
{
printFibonacciNumbers(7);
return 0;
}
We appreciate every question and answer you provide. Keep engaging and finding the best solutions. This community is the perfect place to learn and grow together. IDNLearn.com is committed to providing accurate answers. Thanks for stopping by, and see you next time for more solutions.