fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5. int main()
  6. {
  7. using namespace std;
  8.  
  9. double start=-2, end=0, step=0.2;
  10. size_t n=size_t((end-start)/step)+1;
  11.  
  12. cout << fixed << setprecision(3);
  13.  
  14. for (size_t i=0; i != n; ++i) {
  15. double x = start+i*step;
  16. double y = atan(sqrt(x*x+1));
  17. cout << "x = " << x << "\ty = " << y << endl;
  18. }
  19. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
x = -2.000	y = 1.150
x = -1.800	y = 1.119
x = -1.600	y = 1.083
x = -1.400	y = 1.044
x = -1.200	y = 1.001
x = -1.000	y = 0.955
x = -0.800	y = 0.908
x = -0.600	y = 0.862
x = -0.400	y = 0.822
x = -0.200	y = 0.795
x = 0.000	y = 0.785