Floor-space of the room

Report a typo

Residents of Malevia like to experiment with their rooms. Rooms can be triangular, rectangular, and circle-type. To calculate the area, they need a program that gets the type of room shape and the relevant arguments as input. The program should output the room area.

Malevians use 3.14 for π.

Input format used by the Malevians:

triangle
a
b
c

where a, b and c are lengths of triangle sides.

rectangle
a
b

where a and b are lengths of the rectangle sides.

circle
r

where r is a circle radius.

The input values (a, b, c, r) are double.

Math library may help you to solve this task.

Sample Input 1:

rectangle
4
10

Sample Output 1:

40.0

Sample Input 2:

circle
5

Sample Output 2:

78.5

Sample Input 3:

triangle
3
4
5

Sample Output 3:

6.0
Write a program in Kotlin
fun main() {
// write your code here
}
___

Create a free account to access the full topic