-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathretorno.go
More file actions
55 lines (46 loc) · 735 Bytes
/
retorno.go
File metadata and controls
55 lines (46 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import "fmt"
func main() {
/*
var n1, n2 int8
n1 = 15
n2 = 3
r := suma(n1, n2)
fmt.Println(r)
*/
/*
var edad uint8
edad = 30
fmt.Println(tipoEdad(edad))
*/
n := []int8{52, 63, 47, 5, 5, 3, 7, 6, 100, 2, 47, -5}
maximo, minimo := maxymin(n)
fmt.Println("Máximo:", maximo)
fmt.Println("Mímino:", minimo)
}
func suma(a, b int8) int8 {
return a + b
}
func tipoEdad(edad uint8) string {
var tipo string
switch {
case edad < 12:
tipo = "Niñez"
case edad < 18:
tipo = "Adolescencia"
default:
tipo = "Madurez"
}
return tipo
}
func maxymin(numeros []int8) (max int8, min int8) {
for _, v := range numeros {
if v > max {
max = v
}
if v < min {
min = v
}
}
return
}