Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var locations, dayDigging int
- fmt.Scanln(&locations)
- var averageGold, gold float64
- for i := 0; i < locations; i++ {
- fmt.Scanln(&averageGold)
- fmt.Scanln(&dayDigging)
- goldSum := 0.0
- for j := 0; j < dayDigging; j++ {
- fmt.Scanln(&gold)
- goldSum += gold
- }
- if goldSum / float64(dayDigging) >= averageGold {
- fmt.Printf("Good job! Average gold per day: %.2f.\n", goldSum / float64(dayDigging))
- } else {
- fmt.Printf("You need %.2f gold.\n", averageGold - (goldSum / float64(dayDigging)))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement