- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Kotlin Program To Find The Area of a Trapezium

In this article, we will understand how to find the area of a trapezium. The area of a trapezium is calculated using the formula.

(height/2 * (side1 + side2))

Below is a demonstration of the same −

Suppose our input is −

side1 = 5 side2 = 6 height = 6

The desired output would be −

Area of trapezium is: 33.0

## Algorithm

**Step 1**− START.**Step 2**− Declare four integer values namely side1, side2, height and myResult.**Step 3**− Define the values.**Step 4**− Calculate the area of the trapezium using the formula (height/2 * (side1 + side2) and store the result.**Step 5**− Display the result.**Step 6**− Stop.

## Example 1

In this example, we will find the Area of a Trapezium with the sides and height of the trapezium. First declare and initialize the variables for the sides and height.

val side1 = 5 val side2 = 6 val height = 6

Now, find the Area of a Trapezium using the above formulae −

val myResult = (height/2 * (side1 + side2));

Let us now see the example to find the Area of a Trapezium −

fun main() { val side1 = 5 val side2 = 6 val height = 6 println("The length of sides of the trapezium are defined as $side1, $side2, $height") val myResult = (height/2 * (side1 + side2)); println("The area of square is: $myResult") }

## Output

The length of sides of the trapezium are defined as 5, 6, 6 The area of square is: 33

## Example 2

In this example, we will find the Area of a Trapezium.

fun main() { val side1 = 5 val side2 = 6 val height = 6 println("The length of sides of the trapezium are defined as $side1, $side2, $height") trapeziumArea(side1, side2, height) } fun trapeziumArea(side1: Int, side2: Int, height: Int) { val myResult = (height/2 * (side1 + side2)); println("The area of square is: $myResult") }

## Output

The length of sides of the trapezium are defined as 5, 6, 6 The area of square is: 33

- Related Articles
- Java Program to Find the Area of a Trapezium
- Swift Program To Find The Area of a Trapezium
- Haskell Program to Find the Area of a Trapezium
- Kotlin Program to Find the Area of a Circle
- Kotlin Program to Find the Area of a parallelogram
- Kotlin Program to Find Area of Square
- How To Find The Area of a Trapezium in Golang?
- Program to calculate area and perimeter of Trapezium
- Kotlin Program to Find the Surface Area and Volume of Cuboid
- If the parallel sides of a trapezium are doubled, distance between them remaining same, then find the ratio of the area of the new trapezium to the area of the given trapezium.
- Kotlin Program to Find the Perimeter of a Rectangle
- Kotlin Program to Find the Perimeter of a Circle
- Kotlin Program to Find Factorial of a number
- The parallel sides of a trapezium are 20cm and 10cm. Its nonparallel sides are both equal, each being 13cm. Find the area of the trapezium.
- Java program to find the area of a square