Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var groupNumbers, group int
- fmt.Scanln(&groupNumbers)
- var musala = 0
- var montBlanc = 0
- var kilimanjaro = 0
- var k2 = 0
- var everest = 0
- var alpinistSum = 0
- for i := 0; i < groupNumbers; i++ {
- fmt.Scanln(&group)
- alpinistSum += group
- if group > 40 {
- everest += group
- } else if group > 25 {
- k2 += group
- } else if group > 12 {
- kilimanjaro += group
- } else if group > 5 {
- montBlanc += group
- } else if group > 0 {
- musala += group
- }
- }
- fmt.Printf("%.2f%%\n", float64(100 * musala) / float64(alpinistSum))
- fmt.Printf("%.2f%%\n", float64(100 * montBlanc) / float64(alpinistSum))
- fmt.Printf("%.2f%%\n", float64(100 * kilimanjaro) / float64(alpinistSum))
- fmt.Printf("%.2f%%\n", float64(100 * k2) / float64(alpinistSum))
- fmt.Printf("%.2f%%\n", float64(100 * everest) / float64(alpinistSum))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement