kotlin 查找id

A cube has 6 square faces, if edges length is side. Then the area of each square is side2, thus, the area of cube will be 6*sise2.

如果边的长度为side ,则一个立方体有6个正方形的面。 那么每个正方形的面积是2 ,因此,立方体的面积将是6 * sise 2

Given the value of side of the cube, we have to find its area.

给定立方体的side值,我们必须找到它的面积。

Example:

例:

    Input:
    side = 5

    Output:
    Area of cube = 150.0

程序在Kotlin中查找立方体的区域 (Program to find area of a cube 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 side
    print("Enter Side of Cube : ")
    val side = scanner.nextDouble()

    //Cube Surface Area
    val areaCube = 6*Math.pow(side, 2.toDouble())

    //Print Area
    println("Cube Surface Area on Side ($side) is :$areaCube")
}

Output

输出量

Run 1:
Enter Side of Cube : 5
Cube Surface Area on Side (5.0) is :150.0
---
Run 2:
Enter Side of Cube : 12
Cube Surface Area on Side (12.0) is :864.0


翻译自: https://www.includehelp.com/kotlin/find-area-of-a-cube.aspx

kotlin 查找id

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐