solve Fibonacci series in c++
#include<iostream>
using namespace std;int main()
{
int first = 0, second = 1, next, n;
cout << "Enter the term number: ";
cin >> n;
for(int i = 0; i <= n; i++)
{
if( i <= 1)
next = i;
else
{
next = first + second;
first = second;
second = next;
}
cout << next << " ";
}
return 0;
}
///ahmed shuvo 969
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন