minimum of 3 elements code example
Example 1: minimum of 3 elements
package main
import "fmt"
func min(a, b, c int) int {
if a < b {
if a < c {
return a
}
} else {
if b < c {
return b
}
}
return c
}
func main() {
fmt.Printf("Minimum of 3 elements = %d", min(5,6,7))
}
Example 2: minimum of 3 elements
def min3(a,b,c)
((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
end
print "Min of 3 elements = ", min3(5,6,7);