Guest User

Untitled

a guest
Nov 14th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. int main() {
  2.     double z = 0, z1 = -5.35, z0 = 0.75, n = 0, m = 8, h = 0.9, j = 1;
  3.     for (int i = 1; i <= 45 && j <= m; i++) {
  4.         z = (sqrt(2.0 + sin(z1 + z0)) + sqrt(2.0 - cos(z1 + z0)) + 1.5)*(sqrt(2.0 + sin(z1 + z0)) + sqrt(2.0 - cos(z1 + z0)) + 1.5);
  5.         if (z < j*h && z >= (j - 1)*h) {
  6.             cout << z << " ";
  7.             z0 = z1;
  8.             z1 = z;
  9.             n++;
  10.             j++;
  11.         }
  12.         else{
  13.             z0 = z1;
  14.             z1 = z;
  15.             n++;
  16.             j++;
  17.         }
  18.     }
  19.     cout << n;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment