Parsing Strings

Lab Java Beginner 10 points

Read two words that contain numbers, e.g. 42 and 3.5. Convert them with Integer.parseInt and Double.parseDouble and print their product.

Input

Two lines: an integer, then a decimal.

Output

The product.

Example

Input

42
3.5

Output

147.0
Sample input available Sample output available
Editor
Java

Hints

Integer.parseInt("42") gives the int 42.

Solution explanation

The wrapper classes (Integer, Double, …) convert between text and numbers.

Show solution
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String first = sc.nextLine();
        String second = sc.nextLine();
        int a = Integer.parseInt(first.trim());
        double b = Double.parseDouble(second.trim());
        System.out.println(a * b);
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD