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

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.