Java Program to Multiply two Floating Point Numbers

Write a program to multiply two floating point numbers.

public class MultiplyTwoNumbers {

    public static void main(String[] args) {

        float firstNumber = 1.5f;
        float secondNumber = 2.0f;

        float product = firstNumber * secondNumber;

        System.out.println("The product of multiplication is: " + product);
    }
}

Output

The product of multiplication is: 3.0

Here, we are using hard coded numbers for multiplication. Now, Write a program to multiply two numbers. Take variable input from keyboard.

Leave a Reply