Go program to Find Volume and Surface Area of a Cube

Write a Go program to Find Volume and Surface Area of a Cube. The math formula to calculate the cube volume, surface area, and lateral surface area are

  • Surface Area of a Cube = 6l² (l = length of any side of a Cube).
  • Cube Volume = l * l * l
  • The Lateral Surface Area of a Cube = 4 * (l * l)
package main

import "fmt"

func main() {

    var cblen, cbSA, cbVolume, cbLA float32

    fmt.Print("Enter the Length of any Side of a Cube = ")
    fmt.Scanln(&cblen)

    cbSA = 6 * (cblen * cblen)
    cbVolume = cblen * cblen * cblen
    cbLA = 4 * (cblen * cblen)

    fmt.Println("\nThe Volume of a Cube            = ", cbVolume)
    fmt.Println("The Surface Area of a Cube      = ", cbSA)
    fmt.Println("Lateral Surface Area of a Cube  = ", cbLA)
}
Go program to Find Volume and Surface Area of a Cube