Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var n, dayMinutes, totalMinutes, totalCalories int
- fmt.Scanln(&n)
- var dayDistance, totalDistance float64
- var distanceUnit string
- for i := 0; i < n; i++ {
- fmt.Scanln(&dayMinutes)
- fmt.Scanln(&dayDistance)
- fmt.Scanln(&distanceUnit)
- if distanceUnit == "m" {
- dayDistance *= 0.001
- }
- totalMinutes += dayMinutes
- totalDistance += dayDistance
- totalCalories += dayMinutes * 400 / 20
- }
- fmt.Printf("He ran %.2fkm for %d minutes and burned %d calories.", totalDistance, totalMinutes, totalCalories)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement