|
|
вернуться в форум1001. Runtime error. Java Good afternoon, tell me please, what is wrong with the code? In Eclipse, I have everything working. Maybe I misunderstood condition. I wrote so that the program first asks how many numbers will be introduced, and then takes them. ------------------------------------------- import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.*; public class zadacha { public static void main(String[] args) { System.out.println("Сколько чисел вы хотите ввести?"); Scanner scan = new Scanner(System.in); int temp = scan.nextInt(); int arr[] = new int[temp]; for (int i=0; i < temp; ++i){ System.out.println("Введите число номер " +(i+1)); arr[i] = scan.nextInt(); } scan.close(); DecimalFormatSymbols s = new DecimalFormatSymbols(); s.setDecimalSeparator('.'); DecimalFormat f = new DecimalFormat("#,##0.0000", s); for (int j = temp-1; j >= 0; j--){ double z = Math.sqrt(arr[j]); System.out.println(f.format(z)); } } } Re: 1001. Runtime error. Java Remove all outputs which are not connected with the task. |
|
|