Advertisement
Mushi

ifelseif.go

Apr 25th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.44 KB | None | 0 0
  1. // controles ifelseif ifelseif.go
  2. package main
  3.  
  4. import "fmt"
  5.  
  6. func notaParaConceito(n float64) string {
  7.     if n >= 9 && n <= 10 {
  8.         return "A"
  9.     } else if n >= 8 && n < 9 {
  10.         return "B"
  11.     } else if n >= 5 && n < 8 {
  12.         return "C"
  13.     } else if n >= 3 && n < 5 {
  14.         return "D"
  15.     } else {
  16.         return "E"
  17.     }
  18.  
  19. }
  20. func main() {
  21.     fmt.Println(notaParaConceito(9.8))
  22.     fmt.Println(notaParaConceito(6.9))
  23.     fmt.Println(notaParaConceito(2.1))
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement