Go Language Tutorial

# Go Program to Find Area of a Circle

## Area of a Circle Formula

```Area of a Circle = π * (radius*radius)
```

## Go Program to find area of circle

This Go program gets radius as user inputs and computes the area of a circle.

```package main

import (
"fmt"
"math"
)

func main() {
var area float32

fmt.Println("Finds area of circle")
fmt.Println("--------------------")

area = math.Pi * (float32(radius) * float32(radius))
fmt.Printf("Circle Area: %.2f\n", area)
}
```
Output:
```\$ go build area-of-circle.go
\$ ./area-of-circle
Finds area of circle
--------------------
Circle Area: 78.54
```

## Go Programming Area of Semi-circle formula

```Area of Semi-circle = ( π * radius*radius)/2
```

## Go Program to find the area of circle

This Go program gets radius as user inputs and computes the area of semi-circle.

```package main

import (
"fmt"
"math"
)

func main() {
var area float32

fmt.Println("Finds area of semi-circle")
fmt.Println("--------------------")

area = (math.Pi * (float32(radius) * float32(radius))) /2
fmt.Printf("Semi-circle Area: %.2f\n", area)
}
```
Output:
```\$ go build area-of-semicircle.go
\$ ./area-of-semicircle

Finds area of semi-circle
-------------------