Advertisement
Spocoman

Football League

Oct 9th, 2024
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.87 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var stadiumCapacity, fanCount, sectorA, sectorB, sectorV, sectorG int
  7.     fmt.Scanln(&stadiumCapacity)
  8.     fmt.Scanln(&fanCount)
  9.  
  10.     var currentFanSector string
  11.  
  12.     for i := 0; i < fanCount; i++ {
  13.         fmt.Scanln(&currentFanSector)
  14.         switch currentFanSector {
  15.         case "A":
  16.             sectorA++
  17.         case "B":
  18.             sectorB++
  19.         case "V":
  20.             sectorV++
  21.         case "G":
  22.             sectorG++
  23.         }
  24.     }
  25.  
  26.     fmt.Printf("%.2f%%\n", float64(sectorA) / float64(fanCount) * 100)
  27.     fmt.Printf("%.2f%%\n", float64(sectorB) / float64(fanCount) * 100)
  28.     fmt.Printf("%.2f%%\n", float64(sectorV) / float64(fanCount) * 100)
  29.     fmt.Printf("%.2f%%\n", float64(sectorG) / float64(fanCount) * 100)
  30.     fmt.Printf("%.2f%%\n", float64(fanCount) / float64(stadiumCapacity) * 100)
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement