kotlin 查找id_Kotlin程序来查找Sphere的表面积

kotlin 查找id

Formula to find surface area of Sphere: = 4*PI*r^2

查找球体表面积的公式: = 4 * PI * r ^ 2

Given the value of radius (r), we have to find the Surface area of Sphere.

给定半径( r )的值,我们必须找到球体的表面积。

Example:

例:

    Input:
    radius = 12.6

    Output:
    surface area = 1995.036998735662

在Kotlin中查找Sphere表面积的程序 (Program to find surface area of Sphere in Kotlin)

package com.includehelp

import java.util.*
import kotlin.math.pow

//Main Function , Entry point of Program
fun main(args: Array<String>) {

    //Input Stream
    val scanner = Scanner(System.`in`)

    //Input Radius
    print("Enter Radius of Sphere : ")
    val radius = scanner.nextDouble()

    //surface Area of Sphere
    val sphereSurfaceArea = 4*Math.PI*radius.pow(2)

    //Print Surface Area
    println("Surface Area of Sphere on radius $radius is :$sphereSurfaceArea")
}

Output

输出量

Run 1:
Enter Radius of Sphere : 6
Surface Area of Sphere on radius 6.0 is :452.3893421169302
---
Run 2:
Enter Radius of Sphere : 12.6
Surface Area of Sphere on radius 12.6 is :1995.036998735662


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

kotlin 查找id

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值