Getting started with jmu-java-m01-scanner

enters an integer, and then a floating point number (the number with the decimal point).
summation of two Numbers, and output. And then take the square root of theta and theta and print it out.
then converts the output value to a String (you can use the string.valueof () function), truncating the first six characters (with decimal points).

input format :

integer x floating-point number y

output format :

integer and the sum of floating point Numbers
and the square root of
and the square root of the first six characters

input sample :


output sample :


The answer

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(;
        int num1 = scanner.nextInt();
        double num2 = scanner.nextDouble();
        System.out.println(num1 + num2);
        System.out.println(Math.sqrt(num1 + num2));
        System.out.println(String.valueOf(Math.sqrt(num1 + num2)).substring(0,6));

Read More: