Bot program to count the products bought in the supermarket, with total sum.
package main import "fmt" func main() { var ( productName string price int amount int sum int ) for { fmt.Print("Input product name: ") fmt.Scan(&productName) if productName == "" { break } fmt.Print("Input price: ") fmt.Scan(&price) fmt.Print("Input amount: ") fmt.Scan(&amount) sum += price * amount fmt.Printf("You bought product: %s, price: %d, amount: %d, total sum: %d\n", productName, price, amount, sum) } fmt.Printf("Final sum is %d\n", sum) }