Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var days, foodKg, dogKg, catKg, turtleGr float64
- fmt.Scanln(&days)
- fmt.Scanln(&foodKg)
- fmt.Scanln(&dogKg)
- fmt.Scanln(&catKg)
- fmt.Scanln(&turtleGr)
- var totalKg = (dogKg + catKg + turtleGr / 1000) * days
- if (foodKg >= totalKg) {
- fmt.Printf("%d kilos of food left.",(int)(foodKg - totalKg))
- } else {
- fmt.Printf("%d more kilos of food are needed.", (int)(math.Ceil(totalKg - foodKg)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement