|
|
вернуться в форумI CAN´T SEE WHAT IS WRONG (JAVA ) import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.Scanner; public class Reverse { private static void printer(double value){ String pattern = "###0.0000"; DecimalFormat myFormatter = new DecimalFormat(pattern); String output = myFormatter.format(value); System.out.println(output); } public static void main(String[] args) { Scanner sc = new Scanner(new InputStreamReader(System.in)); long a,b,c,d; a = sc.nextLong(); b = sc.nextLong(); c = sc.nextLong(); d = sc.nextLong(); printer(Math.sqrt(d)); printer(Math.sqrt(c)); printer(Math.sqrt(b)); printer(Math.sqrt(a)); } } Re: I CAN´T SEE WHAT IS WRONG (JAVA ) In your solution, it is possible just 4 numbers (a,b,c,d). Suggestion: try using a loop instead of a,b,c,d and finish the loop when the user type something different than a number |
|
|