Advertisement
Spocoman

Football Results

Oct 9th, 2024
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.57 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var won, lost, drawn, teamOneResult, teamTwoResult int
  7.     var gameResult string
  8.  
  9.     for i := 0; i < 3; i++ {
  10.         fmt.Scanln(&gameResult)
  11.         teamOneResult = int(gameResult[0])
  12.         teamTwoResult = int(gameResult[2])
  13.  
  14.         if teamOneResult > teamTwoResult {
  15.             won++
  16.         } else if teamTwoResult > teamOneResult {
  17.             lost++
  18.         } else {
  19.             drawn++
  20.         }
  21.     }
  22.  
  23.     fmt.Printf("Team won %d games.\nTeam lost %d games.\nDrawn games: %d\n", won, lost, drawn)
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement