Seal_of_approval

p52

Nov 9th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main (void)
  5. {
  6. double b1=0.5;
  7. double b2=0.2;
  8. int n;
  9. cin >> n;
  10. cout << b1 << " " << b2 << " ";
  11. for (int i=2; i<=n;i++)
  12. {
  13. double current;
  14. current = b2*b2+(b1/i);
  15. b1 = b2;
  16. b2 = current;
  17. cout << current << " ";
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment