Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 8, 2018 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/7190495bd4b7c3798fdfb9e7255ab483 to your computer and use it in GitHub Desktop.
Save parzibyte/7190495bd4b7c3798fdfb9e7255ab483 to your computer and use it in GitHub Desktop.
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