Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. float y0=0.182322;
  9. float y1;
  10. int n=1;
  11. int i=1;
  12.  
  13. cout<<"n0: "<<setprecision(4)<<y0<<endl;
  14. for(n;n<=8;n++){
  15. y1=((1.0)/n)-5*y0;
  16. cout<<"n"<<setprecision(4)<<n<<": "<<y1<<endl;
  17. y0=y1;
  18. }
  19.  
  20. cout<<"Druga petla\n\n";
  21. float y9=0.017;
  22. float y8;
  23.  
  24. cout<<"n8: "<<setprecision(4)<<y9<<endl;
  25. for(int n=8;n>=1;n--){
  26. y8=(1.0/(5*n))-0.2*y9;
  27. cout<<"n"<<setprecision(4)<<n-1<<": "<<y8<<endl;
  28. y9=y8;
  29. }
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement