Skip to content

Instantly share code, notes, and snippets.

@samueltcsantos
Created March 1, 2022 20:20
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 samueltcsantos/dfc652f202446c543df87d3dd5dba239 to your computer and use it in GitHub Desktop.
Save samueltcsantos/dfc652f202446c543df87d3dd5dba239 to your computer and use it in GitHub Desktop.
Ler 3 números e exibir o maior e o menor.
package main
import (
"fmt"
)
func main() {
var numero1, numero2, numero3, maior, menor float32
fmt.Print("Numero 1: ")
fmt.Scan(&numero1)
maior = numero1
menor = numero1
fmt.Print("Numero 2: ")
fmt.Scan(&numero2)
if numero2 > maior {
maior = numero2
}
if numero2 < menor {
menor = numero2
}
fmt.Print("Numero 3: ")
fmt.Scan(&numero3)
if numero3 > maior {
maior = numero3
}
if numero3 < menor {
menor = numero3
}
fmt.Println("O maior é ", maior)
fmt.Println("O menor é ", menor)
}
@samueltcsantos
Copy link
Author

Faça um Programa que leia três números e mostre o maior e o menor deles.
Check out my page to see other examples Mais exemplos ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment