Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var bedPrice, food, totalFood float64
- fmt.Scanln(&bedPrice)
- var catCount, firstGroup, secondGroup, thirdGroup int
- fmt.Scanln(&catCount)
- for i := 0; i < catCount; i++ {
- fmt.Scanln(&food)
- totalFood += food
- if food >= 100 && food < 200 {
- firstGroup++
- } else if food >= 200 && food < 300 {
- secondGroup++
- } else if food >= 300 && food < 400 {
- thirdGroup++
- }
- }
- priceForFoodPerDay := totalFood * 0.01245
- fmt.Printf("Group 1: %d cats.\n", firstGroup)
- fmt.Printf("Group 2: %d cats.\n", secondGroup)
- fmt.Printf("Group 3: %d cats.\n", thirdGroup)
- fmt.Printf("Price for food per day: %.2f lv.\n", priceForFoodPerDay)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement