Kotlin program to find area of Parallelogram

Kotlin | Area of Parallelogram: Here, we are going to implement a Kotlin program to find the area of Parallelogram.
Submitted by IncludeHelp, on May 22, 2020

Formula to find area of Parallelogram: area = base*height

Given the value of base and height, we have to find the area of Parallelogram.

Example:

    Input:
    base = 5
    height = 8

    Output:
    area = 40.0

Program to find area of Parallelogram in Kotlin

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 Base of Parallelogram
    print("Enter Parallelogram Base : ")
    val b = scanner.nextDouble()

    //Input Height of Parallelogram
    print("Enter Parallelogram Height : ")
    val h = scanner.nextDouble()

    //Calculate Area of Parallelogram
    val areaParallelogram = b * h

    //Print Area
    println("Area of Parallelogram is :$areaParallelogram")
}

Output

Run 1:
Enter Parallelogram Base : 5
Enter Parallelogram Height : 8
Area of Parallelogram is :40.0
---
Run 2:
Enter Parallelogram Base : 5.7
Enter Parallelogram Height : 3
Area of Parallelogram is :17.1






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.