Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "strconv"
- )
- func main() {
- var input string
- fmt.Scanln(&input)
- var sum = 0.0
- for i:= 0; input != "NoMoreMoney"; i++ {
- money,_ := strconv.ParseFloat(input, 64)
- if money < 0 {
- fmt.Println("Invalid operation!")
- break
- }
- sum += money
- fmt.Printf("Increase: %.2f\n", money)
- fmt.Scanln(&input)
- }
- fmt.Printf("Total: %.2f\n", sum)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement