Learn about Go program to find the average of three numbers in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
Go program to find the average of three numbers
// Go program to find the average of three numbers.
package main
import "fmt"
func main() {
var num1 int =5
var num2 int =10
var num3 int =20
var avg int=0
avg=(num1+num2+num3)/3
fmt.Println("Average is: ",avg)
}
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Go program to add two numbers
Golang program to print Hello World