Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var days int
- fmt.Scanln(&days)
- var kilometers, percentage float64
- fmt.Scanln(&kilometers)
- totalKilometers := kilometers
- for i := 0; i < days; i++ {
- fmt.Scanln(&percentage)
- kilometers *= (100 + percentage) / 100
- totalKilometers += kilometers
- }
- if totalKilometers < 1000 {
- fmt.Printf("Sorry Mrs.Ivanova, you need to run %d more kilometers", 1000 - int(totalKilometers))
- } else {
- fmt.Printf("You've done a great job running %d more kilometers!", int(math.Ceil(totalKilometers) - 1000))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement