Java program to multiply given floating point numbers


Example

Following is a program to multiply given floating point numbers.

import java.util.Scanner;
public class MultiplyFloatingNumbers {
   public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter first floating point number.");
      float flt1 = sc.nextFloat();

      System.out.println("Enter second floating point number.");
      float flt2 = sc.nextFloat();

      float product = flt1*flt2;
      System.out.println("Product of given floating point numbers ::"+product);
   }
}

Output

Enter first floating point number.
2.2
Enter second floating point number.
6.3
Product of given floating point numbers ::13.860001

Updated on: 13-Mar-2020

763 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements