Created
March 8, 2018 05:35
-
-
Save parzibyte/7190495bd4b7c3798fdfb9e7255ab483 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
numeros := [...] int {18, 28, 21, 96, 97, 30, 50, 128, -1, -50, 55, 800, 450} | |
numeroMayor, numeroMenor := numeros[0], numeros[0] | |
for _, numero := range numeros { | |
if numero > numeroMayor{ | |
numeroMayor = numero | |
} | |
if numero < numeroMenor{ | |
numeroMenor = numero | |
} | |
} | |
fmt.Printf("En el arreglo %v\nEl número menor es %d. \nY el mayor es %d\n", numeros, numeroMenor, numeroMayor) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment