Skip to content

Instantly share code, notes, and snippets.

@samueltcsantos
Created March 4, 2022 00:15
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/ab6559def41e4540a18f36f215e1d28a to your computer and use it in GitHub Desktop.
Save samueltcsantos/ab6559def41e4540a18f36f215e1d28a to your computer and use it in GitHub Desktop.
Calcular o reajuste salarial.
package main
import (
"fmt"
)
func main() {
var salario, aumento, percentual float32
fmt.Print("Salario: ")
fmt.Scan(&salario)
if salario <= 280 {
percentual = 0.20 // 20 % = 20/100 = 0.20
} else if salario > 280 && salario <= 700 {
percentual = 0.15 // 15%
} else if salario > 700 && salario <= 1500 {
percentual = 0.10 // 10 %
} else if salario > 1500 {
percentual = 0.05 // 5%
}
aumento = salario * percentual
fmt.Println("Salário: R$ ", salario)
fmt.Println("Percentual: (%) ", percentual* 100)
fmt.Println("Aumento: R$ ", aumento)
fmt.Println("Novo Salário: R$ ", salario + aumento)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment