2
Contributors
1
Reply
23
Views
4 Years
Discussion Span
Last Post by danyal baig
-2
#include<iostream>
using namespace std;
int main(){

   int num,first=0,second=1,next;
   cout << "Enter the number " << endl;
   cin >> num;
   cout << "First "<<num<<"terms of Fibonacci series are :-"<<endl;
   for ( int loop=0;loop<num;loop++){

         next=first+second;
         first=second;
         second=next;

      cout<<next<<endl;
   }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.