Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var months int
- fmt.Scanln(&months)
- var electricity = 0.0
- var water = 20.00
- var internet = 15.00
- var other = 0.0
- var currentBill float64
- for i := 0; i < months; i++ {
- fmt.Scanln(¤tBill)
- electricity += currentBill
- other += (currentBill + water + internet) * 1.2
- }
- var average = (electricity + other) / float64(months) + water + internet
- fmt.Printf("Electricity: %.2f lv\n", electricity)
- fmt.Printf("Water: %.2f lv\n", water * float64(months))
- fmt.Printf("Internet: %.2f lv\n", internet * float64(months))
- fmt.Printf("Other: %.2f lv\n", other)
- fmt.Printf("Average: %.2f lv\n", average)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement