fork download
  1. /* Lab4.11A (REPEAT (do..while)) */
  2. import java.util.*;
  3. public class Main {
  4. public static void main(String[] args) {
  5. double x=0.0; double y=0.0;
  6. double A, B, dx;
  7. Scanner in = new Scanner(System.in);
  8. A = in.nextDouble();
  9. B = in.nextDouble();
  10. dx = in.nextDouble();
  11. x = A;
  12. do {
  13. y = 2 * Math.sin(2 * x);
  14. System.out.println("x=" + String.format("%.6f", x) + " y=" + String.format("%.6f", y));
  15. x = x + dx;
  16. } while (x <= B);
  17. in.close();
  18. }
  19. }
Success #stdin #stdout 0.27s 59044KB
stdin
0
5
0.5
stdout
x=0.000000 y=0.000000
x=0.500000 y=1.682942
x=1.000000 y=1.818595
x=1.500000 y=0.282240
x=2.000000 y=-1.513605
x=2.500000 y=-1.917849
x=3.000000 y=-0.558831
x=3.500000 y=1.313973
x=4.000000 y=1.978716
x=4.500000 y=0.824237
x=5.000000 y=-1.088042