fork download
  1. public class Main {
  2. public static void main(String[] args) {
  3. double A = 0.0, B = 2.0, dx = 0.2;
  4. double x = A;
  5. System.out.println("--- Do-While ---");
  6. do {
  7. double y = Math.atan(x) + Math.atan((1 - x) / (1 + x));
  8. System.out.printf("x: %.2f | y: %.4f%n", x, y);
  9. x += dx;
  10. } while (x <= B + 1e-9);
  11. }
  12. }
Success #stdin #stdout 0.14s 56188KB
stdin
Standard input is empty
stdout
--- Do-While ---
x: 0.00 | y: 0.7854
x: 0.20 | y: 0.7854
x: 0.40 | y: 0.7854
x: 0.60 | y: 0.7854
x: 0.80 | y: 0.7854
x: 1.00 | y: 0.7854
x: 1.20 | y: 0.7854
x: 1.40 | y: 0.7854
x: 1.60 | y: 0.7854
x: 1.80 | y: 0.7854
x: 2.00 | y: 0.7854