Learn about How to find the largest number between two numbers in Golang in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
How to find the largest number between two numbers in Golang
// Golang program to find the largest number between two numbers
// using math.Max() function.
package main
import "fmt"
import "math"
func main() {
var num1 float64 = 15.46
var num2 float64 = 56.68
var large float64 = 0
large=math.Max(num1, num2)
fmt.Printf("Largest number is : %f",large)
}
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
How to calculate the power of a number in Golang
How to print the absolute value for an integer number in Golang