how to get max value between two int values in go
package main
import (
"fmt"
)
func main() {
// Declare two integer variables
var num1, num2 int
// Assign values to the variables
num1 = 10
num2 = 20
// Use conditional operator to find the maximum value
maxValue := getMax(num1, num2)
// Print the result
fmt.Printf("The maximum value between %d and %d is: %d\n", num1, num2, maxValue)
}
// Function to get the maximum value between two integers
func getMax(a, b int) int {
if a > b {
return a
}
return b
}