import java.util.Scanner; import java.text.DecimalFormat; class CalMath { public static void main(String[] args) { DecimalFormat f1 = new DecimalFormat("0.0"); Scanner input = new Scanner(System.in); while(input.hasNextDouble()) { double x = input.nextDouble(); double y = func(x); System.out.println(f1.format(y)); } System.out.println("Done."); } //-------------------------------------- private static double func(double x) { double y = Math.sqrt(x+1); return y; } }