Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var command, currentPlayer, bestPlayer string
- var currentPlayerGoals, bestPlayerGoals int
- fmt.Scanln(&command)
- for command != "END" {
- currentPlayer = command
- fmt.Scanln(¤tPlayerGoals)
- if currentPlayerGoals > bestPlayerGoals {
- bestPlayer = currentPlayer
- bestPlayerGoals = currentPlayerGoals
- }
- if bestPlayerGoals >= 10 {
- break
- }
- fmt.Scanln(&command)
- }
- fmt.Printf("%s is the best player!\n", bestPlayer)
- if bestPlayerGoals < 3 {
- fmt.Printf("He has scored %d goals.\n", bestPlayerGoals)
- } else {
- fmt.Printf("He has scored %d goals and made a hat-trick !!!\n", bestPlayerGoals)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement