Explain the result

Report a typo

Imagine that you have a program that calculates the area of a triangle. It reads a base and a height from the standard input:

val base = readln().toDouble()
val height = readln().toDouble()
val area = (base * height) / 2

println(area)

You have entered the following base and height:

2.2 4.01

The result is:

4.4110000000000005

However, your calculator says that the result is 4.411.

Explain the result of your program.

Select one option from the list
___

Create a free account to access the full topic