ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

1001. Runtime error. Java
Posted by Java.Xotatel 15 Oct 2015 12:55
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
Posted by Solikov 27 Oct 2015 21:01
Remove all outputs which are not connected with the task.