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