- 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 Surface Area and Volume of Cuboid

In this article, we will understand how to compute the surface area and volume the cuboid. The surface area of cuboid is calculated using the formula −

2*( length *width + width* height + height*length)

The Volume of the cuboid is calculated using the formula

length*width*height

Below is a demonstration of the same −

Suppose our input is −

length= 6; width= 7; height= 8;

The desired output would be −

Volume Of the Cuboid is : 336.0 Surface area Of the Cuboid is : 292.0

## Algorithm

**Step 1**− START**Step 2**− Declare five double values namely length, width, height, volume, surfaceArea**Step 3**− Define the values**Step 4**− Use the formula 2*( length *width + width* height + height*length) to calculate the surface area of cuboid**Step 5**− Use the formula length*width*height to calculate the area of the cuboid**Step 6**− Display the result**Step 7**− Stop

## Example 1

In this example, we will find the Volume and Surface Area of the cuboid using the length, width and height of the cuboid. First, declare and initialize the variables length, width and height −

val length = 6 val width = 7 val height = 8

Now, using the above formulae, find the Volume of Cuboid

val volume = length * width * height

In a similar way, find the Surface Area of Cuboid

val surfaceArea =2*( length * width + width * height + height * length);

Let us now see the final example to find the Volume and Surface Area of the cuboid −

fun main() { val length = 6 val width = 7 val height = 8 println("The length, width and height of the cuboid is defined as $length, $width and $height") val volume = length * width * height val surfaceArea =2*( length * width + width * height + height * length); println("The volume of the cuboid is: $volume") println("The surface area of the cuboid is: $surfaceArea") }

## Output

The length, width and height of the cuboid is defined as 6, 7 and 8 The volume of the cuboid is: 336 The surface area of the cuboid is: 292

## Example 2

In this example, we will find the Surface Area and Volume of Cuboid

fun main() { val length = 6 val width = 7 val height = 8 println("The length, width and height of the cuboid is defined as $length, $width and $height") cuboid(length, width, height) } fun cuboid(length: Int, width : Int, height : Int) { val volume = length * width * height val surfaceArea =2*( length * width + width * height + height * length); println("The volume of the cuboid is: $volume") println("The surface area of the cuboid is: $surfaceArea") }

## Output

The length, width and height of the cuboid is defined as 6, 7 and 8 The volume of the cuboid is: 336 The surface area of the cuboid is: 292

- Related Articles
- Java Program to Find the Surface area and Volume of Cuboid
- Swift Program to Find the Surface area and Volume of Cuboid
- Haskell Program to Find the Surface area and Volume of Cuboid
- Program for Volume and Surface Area of Cuboid in C++
- How to find the Surface area and Volume of Cuboid in Golang?
- Golang program to Calculate the Volume, Diagonal and Area of a Cuboid?
- Two cubes each of volume $27\ m^{3}$ are joined end to end. Find the surface area of the resulting cuboid.
- Two cubes each of volume $64\ cm^3$ are joined end to end. Find the surface area of the resulting cuboid.
- 2 cubes each of volume $64\ cm^3$ are joined end to end. Find the surface area of the resulting cuboid."
- Two cubes, each of volume $512\ cm^3$ are joined end to end. Find the surface area of the resulting cuboid.
- Program for Volume and Surface Area of Cube in C++
- Find maximum volume of a cuboid from the given perimeter and area in C++
- What is total surface area of cuboid?
- Find the lateral surface area and total surface area of a cuboid of length $80\ cm$, breadth $40\ cm$ and height $20\ cm$.
- How to find Volume and Surface Area of a Sphere using C#?