Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var stadiumCapacity, fanCount, sectorA, sectorB, sectorV, sectorG int
- fmt.Scanln(&stadiumCapacity)
- fmt.Scanln(&fanCount)
- var currentFanSector string
- for i := 0; i < fanCount; i++ {
- fmt.Scanln(¤tFanSector)
- switch currentFanSector {
- case "A":
- sectorA++
- case "B":
- sectorB++
- case "V":
- sectorV++
- case "G":
- sectorG++
- }
- }
- fmt.Printf("%.2f%%\n", float64(sectorA) / float64(fanCount) * 100)
- fmt.Printf("%.2f%%\n", float64(sectorB) / float64(fanCount) * 100)
- fmt.Printf("%.2f%%\n", float64(sectorV) / float64(fanCount) * 100)
- fmt.Printf("%.2f%%\n", float64(sectorG) / float64(fanCount) * 100)
- fmt.Printf("%.2f%%\n", float64(fanCount) / float64(stadiumCapacity) * 100)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement