|
|
вернуться в форумWhere is my fault ? import java.util.Scanner; public class main { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); String a = scan.nextLine(); double b = Double.parseDouble(a); double c; double d = b; double mass[] = new double[(int)b]; while (b != 0) { c = Math.sqrt(scan.nextDouble()); mass[(int)(b - 1)] = c; b--; } for (double i = 0; i < d; i++) { System.out.printf("%.4f\n", mass[(int)i]); } } } Outputs "Runtime error" Edited by author 09.10.2017 00:50 Re: Where is my fault ? Please look at example, try to find count of inputs you are reading into b. |
|
|