How to find the larger of two numbers with Max function in Go

2 Answers

0 votes
package main 
   
import ( 
    "fmt"
	"math"
) 
   
func main() { 
	var x float64
 	x = math.Max(-2, 8)
 
 	fmt.Println(x)
} 
 
 
 
/*
run:
 
8

*/

 



answered Aug 4, 2020 by avibootz
0 votes
package main 
    
import ( 
    "fmt"
    "math"
) 
    
func main() { 
    var x float64
    x = math.Max(-2.3, -2.4)
  
    fmt.Println(x)
} 
  
  
  
/*
run:
  
-2.3
 
*/

 



answered Aug 4, 2020 by avibootz
...