Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "strconv"
- )
- func main() {
- var neededSteps = 10000
- var input string
- for ; neededSteps > 0; {
- fmt.Scanln(&input)
- if input == "GoingHome" {
- fmt.Scanln(&input)
- steps,_ := strconv.Atoi(input)
- neededSteps -= steps
- break
- }
- steps,_ := strconv.Atoi(input)
- neededSteps -= steps
- }
- if neededSteps > 0 {
- fmt.Printf("%d more steps to reach goal.\n", neededSteps)
- } else {
- fmt.Printf("Goal reached! Good job!\n%d steps over the goal!", neededSteps * -1)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement