Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var days, hours int
- fmt.Scanln(&days)
- fmt.Scanln(&hours)
- var totalPrice = 0.0
- for day := 1; day <= days; day++ {
- var dayPrice = 0.0
- for hour := 1; hour <= hours; hour++ {
- if day % 2 == 0 && hour % 2 == 1 {
- dayPrice += 2.50
- } else if day % 2 == 1 && hour % 2 == 0 {
- dayPrice += 1.25
- } else {
- dayPrice++
- }
- }
- totalPrice += dayPrice
- fmt.Printf("Day: %d - %.2f leva\n", day, dayPrice)
- }
- fmt.Printf("Total: %.2f leva\n", totalPrice)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement