Advertisement
Spocoman

Vet Parking

Oct 14th, 2024
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.75 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var days, hours int
  7.     fmt.Scanln(&days)
  8.     fmt.Scanln(&hours)
  9.    
  10.     total := 0.0
  11.  
  12.     for day := 1; day <= days; day++ {
  13.         sum := 0.0
  14.         for hour := 1; hour <= hours; hour++ {
  15.             if day % 2 == 1 {
  16.                 if hour % 2 == 1 {
  17.                         sum += 1.00
  18.                 } else {
  19.                     sum += 1.25
  20.                 }
  21.             } else {
  22.                 if hour % 2 == 1 {
  23.                     sum += 2.50
  24.                 } else {
  25.                     sum += 1.00
  26.                 }
  27.             }
  28.         }
  29.         fmt.Printf("Day: %d - %.2f leva\n", day, sum)
  30.         total += sum
  31.     }
  32.  
  33.     fmt.Printf("Total: %.2f leva\n", total)
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement