package com.includehelp
import java.util.*
//Main Function , Entry point of Program
fun main(args: Array<String>) {
//Input Stream
val scanner = Scanner(System.`in`)
//Input Length of Rectangle
print("Enter Rectangle Length : ")
val length = scanner.nextDouble()
//Input Width of Rectangle
print("Enter Rectangle Width : ")
val width = scanner.nextDouble()
//Calculate Area of Rectangle
val rectangleArea = length * width
//Print Area
println("Area of Rectangle is :$rectangleArea")
}
Output
Run 1:
Enter Rectangle Length : 2.6
Enter Rectangle Width : 3.2
Area of Rectangle is :8.32
---
Run 2:
Enter Rectangle Length : 6
Enter Rectangle Width : 8
Area of Rectangle is :48.0
Program to find area of Rectangle in Kotlin
Output
need an explanation for this answer? contact us directly to get an explanation for this answer