[Solved] I need to print this in printf [closed]
Try using System.out.printf(“%.2f%n”, x[i]); EDIT Here’s another idea, based on your desired output: double[] x = { 1.0, 0.90, 0.80, 0.70, 0.60, 0.50, 0.40, 0.30, 0.20, 0.10, 0.00, -0.10, -0.20, -0.30, -0.40, -0.50, -0.60, -0.70, -0.80, -0.90, -1.00 }; double r = 1; for (int i = 0; i < x.length; i++) { double y … Read more