Go program to Find Volume and Surface Area of a Sphere

This Go program to Find Volume and Surface Area of a Sphere allows users to enter the sphere’s radius. Next, it will calculate the surface area using a mathematical formula, where r is the radius.

  • Sphere Surface Area = 4πr²
  • The radius of a Sphere = √surface_area / 4π
  • Sphere Volume = 4πr³
package main

import "fmt"

func main() {
    
    var spRadius, spSA, spVolume

    fmt.Print("Enter the Sphere Radius= ")
    fmt.Scanln(&spRadius)

    spSA = 4 * 3.14 * spRadius * spRadius
    spVolume = (4.0/3) * 3.14 * spRadius * spRadius * spRadius

    fmt.Println("The Surface Area of a Sphere  = ", spSA)
    fmt.Println("The Volume of a Sphere  = ", spVolume)
}
Go Program to Find Volume and Surface Area of a Sphere