Explain the result

Report a typo

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

Scanner scanner = new Scanner(System.in);

double base = scanner.nextDouble();
double height = scanner.nextDouble();
double area = (base * height) / 2;

System.out.println(area);

You entered the base and the height.

2.2 4.01
The result is:
4.4110000000000005

But 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