Advertisement
Spocoman

04. Transport Price

Sep 16th, 2024
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.48 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var km int
  6.     fmt.Scanln(&km)
  7.    
  8.     var time string
  9.     fmt.Scanln(&time)
  10.    
  11.     var price = 0.0
  12.  
  13.     if (km < 20) {
  14.         if (time == "day") {
  15.             price = float64(km) * 0.79 + 0.70
  16.         } else {
  17.             price = float64(km) * 0.90 + 0.70
  18.         }
  19.     } else if (km >= 100) {
  20.         price = float64(km) * 0.06
  21.     } else {
  22.         price = float64(km) * 0.09
  23.     }
  24.  
  25.     fmt.Printf("%.2f\n",  price)
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement