write a Java program to multiply to floating point numbers at class 8th level
Answers
Answer:
import java.util.Scanner;
public class test {
public static void main(String[] args) {
/* This reads the input provided by user
* using keyboard
*/
Scanner sc = new Scanner(System.in);
System.out.print("Enter first number: ");
// This method reads the number provided using keyboard
float num1 = sc.nextFloat();
System.out.print("Enter second number: ");
float num2 = sc.nextFloat();
// Closing Scanner after the use
sc.close();
// Calculating product of two numbers
float product = num1*num2;
// Displaying the multiplication result
System.out.println("Output: "+product);
}
}
Explanation: