How to calculate the volume of a cylinder in Go

1 Answer

0 votes
package main

import (
	"fmt"
	"math"
)

func main() {
	height := 26
	radius := 12

	cylinderVolume := math.Pi * float64(radius*radius) * float64(height)

	fmt.Printf("Cylinder volume = %f\n", cylinderVolume)
}


/*
run:

Cylinder volume = 11762.122895

*/

 



answered Sep 26, 2024 by avibootz

Related questions

1 answer 157 views
1 answer 120 views
1 answer 107 views
1 answer 107 views
1 answer 112 views
1 answer 139 views
1 answer 129 views
...