Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- float y0=0.182322;
- float y1;
- int n=1;
- int i=1;
- cout<<"n0: "<<setprecision(4)<<y0<<endl;
- for(n;n<=8;n++){
- y1=((1.0)/n)-5*y0;
- cout<<"n"<<setprecision(4)<<n<<": "<<y1<<endl;
- y0=y1;
- }
- cout<<"Druga petla\n\n";
- float y9=0.017;
- float y8;
- cout<<"n8: "<<setprecision(4)<<y9<<endl;
- for(int n=8;n>=1;n--){
- y8=(1.0/(5*n))-0.2*y9;
- cout<<"n"<<setprecision(4)<<n-1<<": "<<y8<<endl;
- y9=y8;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement