Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* A program to print out items in the series 1 1 2 3 5 8 13 ... until the last term is greater than 10000
- * Author : Taqui
- */
- #include <iostream>
- using namespace std;
- int main() {
- int i=1,j=1; cout << i << " ";
- for (int k=1;k<=10000;k=i+j) {
- cout << k << " ";
- i=j;
- j=k;
- if (i+j>10000)
- cout << i+j;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement