Advertisement
Ahmed_Negm

Untitled

Dec 9th, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<cmath>
  4. #include<algorithm>
  5. // #include <algorithm>
  6. using namespace std;
  7. void Ahmed_Negm(){
  8.   #ifndef ONLINE_JUDGE  
  9.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  10.   #endif
  11. }
  12. int main()
  13. {Ahmed_Negm();
  14.  
  15.  
  16. long long n, first = 0, second = 1, sum =0;
  17. cin>>n;
  18. cout<<first<<" "<<second<<" ";
  19. for(int i = 2; i<n; i++){
  20.  
  21.  
  22. sum = first + second;
  23. cout<<sum<<" ";
  24. first = second;
  25. second = sum;
  26.  
  27.  
  28. }
  29.  
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement