fork download
  1. program CalculateY;
  2. uses Math;
  3. var
  4. x_values: array[1..7] of real = (-10, -1, -0.5, 0, 0.5, 1, 10);
  5. x, arctg_x, arctg_1x, y: real;
  6. i: integer;
  7. begin
  8. for i := 1 to 7 do
  9. begin
  10. x := x_values[i];
  11. writeln;
  12. writeln('Please enter value for x = ', x:0:2);
  13.  
  14. if x = 0 then
  15. begin
  16. writeln('RROR: division by zero (1/x).');
  17. continue;
  18. end;
  19. arctg_x := arctan(x);
  20. arctg_1x := arctan(1/x);
  21. y := arctg_x - arctg_1x;
  22.  
  23. writeln('arctg(x) = ', arctg_x);
  24. writeln('arctg(1/x) = ', arctg_1x);
  25. writeln('y = arctg(x) - arctg(1/x) = ', y);
  26. end;
  27. end.
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Please enter value for x = -10.00
arctg(x) = -1.4711276743037347E+000
arctg(1/x) = -9.9668652491162038E-002
y = arctg(x) - arctg(1/x) = -1.3714590218125726E+000

Please enter value for x = -1.00
arctg(x) = -7.8539816339744828E-001
arctg(1/x) = -7.8539816339744828E-001
y = arctg(x) - arctg(1/x) =  0.0000000000000000E+000

Please enter value for x = -0.50
arctg(x) = -4.6364760900080609E-001
arctg(1/x) = -1.1071487177940904E+000
y = arctg(x) - arctg(1/x) =  6.4350110879328426E-001

Please enter value for x = 0.00
RROR: division by zero (1/x).

Please enter value for x = 0.50
arctg(x) =  4.6364760900080609E-001
arctg(1/x) =  1.1071487177940904E+000
y = arctg(x) - arctg(1/x) = -6.4350110879328426E-001

Please enter value for x = 1.00
arctg(x) =  7.8539816339744828E-001
arctg(1/x) =  7.8539816339744828E-001
y = arctg(x) - arctg(1/x) =  0.0000000000000000E+000

Please enter value for x = 10.00
arctg(x) =  1.4711276743037347E+000
arctg(1/x) =  9.9668652491162038E-002
y = arctg(x) - arctg(1/x) =  1.3714590218125726E+000