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