'

Assignments » Flow Of Control » Set 2 » Solution 12

Source Code: 


#include<iostream>
using namespace std;


int main()
{
 int f=0,s=1,t,n;
 
 cout<<"Enter Number of terms of Series : ";
 cin>>n;
 
 cout<<f<<" "<<s<<" ";
 
 for(int i=3;i<=n;i++)
 {
  t=f+s;
  cout<<t<<" ";
  f=s;
  s=t;
 }
 
 
 return 0;
}



Post a Comment

 
Top