FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 49   



Following program shows you how to calculate circle area.
In this tutorial will get circle radius from user and calculate area and prints it using following formula
Area = PI X r X r

package main

import "fmt"

func main() {

  var circleRadius float64
  var areaOfCircle float64
  fmt.Println("Please enter the radius of circle:")
  fmt.Scanf("%f", &circleRadius)
  areaOfCircle = 22/7 * (circleRadius * circleRadius)
  fmt.Println("Area of circle is: " , areaOfCircle)
}

Output:

Please enter the radius of circle:
 6
Area of circle is:  108



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News