Advertisement
Guest User

bai1fibonaci

a guest
Feb 24th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int num, num1 = 0, num2 = 1, next;
  6. cin >> num;
  7. for (int i = 0; i < num; i++)
  8. {
  9. cout << num1 << endl;
  10. next = num1 + num2;
  11. num1 = num2;
  12. num2 = next;
  13. }
  14. system("pause");
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement