Advertisement
Spocoman

Tennis Ranklist

Oct 13th, 2024
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.80 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.   var numberOfTournaments, startPoints, tournamentPoints, gamesWon int
  7.     fmt.Scanln(&numberOfTournaments)
  8.     fmt.Scanln(&startPoints)
  9.    
  10.     var currentTournament string
  11.        
  12.     for i := 0; i < numberOfTournaments; i++ {
  13.         fmt.Scanln(&currentTournament)
  14.         if currentTournament == "W" {
  15.             tournamentPoints += 2000
  16.             gamesWon++;
  17.         } else if currentTournament == "F" {
  18.             tournamentPoints += 1200
  19.         } else {
  20.             tournamentPoints += 720
  21.         }
  22.     }
  23.  
  24.     fmt.Printf("Final points: %d\n", startPoints + tournamentPoints)
  25.     fmt.Printf("Average points: %d\n", tournamentPoints / numberOfTournaments)
  26.     fmt.Printf("%.2f%%\n", float64(gamesWon) / float64(numberOfTournaments) * 100)
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement