Created
June 6, 2018 09:45
-
-
Save sajjadyousefnia/a534fbaa93b9e48b399e61a894a50de5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun printCircumferenceAndArea(radius: Double): Unit { | |
fun calCircumference(radius: Double): Double = (2 * Math.PI) * radius | |
val circumference = "%.2f".format(calCircumference(radius)) | |
fun calArea(radius: Double): Double = (Math.PI) * Math.pow(radius, 2.0) | |
val area = "%.2f".format(calArea(radius)) | |
print("The circle circumference of $radius radius is $circumference and area is $area") | |
} | |
printCircumferenceAndArea(3.0) // The circle circumference of 3.0 radius is 18.85 and area is 28.27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment