Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n, nextTerm, t1=0, t2=1;
- cout << "Enter term (>2): ";
- cin >> n;
- cout << t1 << "\n"<< t2 <<endl;
- for(int i=3;i<=n;i++)
- {
- nextTerm=t1+t2;
- cout << nextTerm << endl;
- t1=t2;
- t2=nextTerm;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement