डाउनलोड पी.डी.एफ. ई-बुक्स
C++ - Fibonacci Series

विवरण :

कोई विवरण नहीं है |


सोर्स कोड :

#include
#include
using namespace std;

int main()
{
int n, i, first = 0, second = 1, next;

cout << "Enter the number of terms" << endl;
cin >> n;

cout << "Fibonacci series are " << endl;
for (i = 0 ; i < n ; i++)
{
if (i <= 1)
next = i;
else
{
next = first + second;
first = second;
second = next;
}
cout <

आउटपुट :

Enter the number of terms
5
Fibonacci series are
0
1
1
2
3