# Kotlin Program to Multiply two Floating Point Numbers

In this post, we will learn to code the Kotlin Program to Multiply two Floating Point Numbers. Let’s see How to multiply two floating point numbers in Kotlin Programming Language.

## What are Floating-Point Numbers?

Floating-point numbers are the decimal representations of fractional numbers. The fractional part of the number is separated by the integer part using (.)

In Kotlin Programming Language, there are two Floating-point types, `Decimal` and `Float`. The main difference between them is the precision, and how many decimal places they can store.

Now, let’s see how we use Floating-point numbers in Kotlin,

```    var x = 1.23 // Double
var xFloat = 1.23456f // Float (we add 'f' to make kotlin know it's float)```

So, we got the basic idea about the floating point numbers in Kotlin Programming Language. It’s time to see the Kotlin Program to Multiply two Floating Point Numbers.

## Kotlin Program to Multiply two Floating Point Numbers

Let’s see the Kotlin Program to Multiply two Floating Point Numbers (Double)

```fun main() {
//Double Multiplication
var num1 = 2.34545;
var num2 = 4.56;

var result = num1 * num2;

println("The product is: \$result");
}```

Output

``The product is: 10.695252``

## How Does This Program Work?

```    var num1 = 2.34545;
var num2 = 4.56;```

First, we declared and initialized two Decimal floating-point type variables using the `var` keyword in Kotlin Programming Language.

`    var result = num1 * num2;`

then, we multiply, `num1` and `num2` using the * operator and storing the value in variable `result`.

`println("The product is: \$result");`

then, using `println()` we print the result.

This is the Kotlin Program to Multiply two Floating Point Numbers (Decimal type). Now, let’s see the multiplication of Float type.

## Kotlin Program to Multiply two Floating Point Numbers

Let’s see the Kotlin Program to Multiply two Floating Point Numbers (Float)

```fun main() {
//Float Multiplication
var num1 = 2.34545f;
var num2 = 4.56f;

var result = num1 * num2;

println("The product is: \$result");
}```

Output

``The product is: 10.695251``

## How Does This Program Work?

```    var num1 = 2.34545f;
var num2 = 4.56f;```

First, we declared and initialized two Float floating-point type variables using the `var` keyword in Kotlin Programming Language.

`    var result = num1 * num2;`

then, we multiply, `num1` and `num2` using the * operator and storing the value in variable `result`.

`println("The product is: \$result");`

then, using `println()` we print the result.

This is the Kotlin Program to Multiply two Floating Point Numbers (Float type).

We learned about the Kotlin Program to Multiply two Floating Point Numbers using both FLoat and Double.

## Conclusion

I hope after going through this post, you understand how to code Kotlin Program to Multiply two Floating Point Numbers.
If you have any doubt regarding the topic, feel free to contact us in the Comment Section. We will be delighted to help you.