Advertisement
Spocoman

Add Bags

Sep 26th, 2024
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.65 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var priceBagOver20kg, bagWeight float64
  7.     fmt.Scanln(&priceBagOver20kg)
  8.     fmt.Scanln(&bagWeight)
  9.    
  10.     var days, bags int
  11.     fmt.Scanln(&days)
  12.     fmt.Scanln(&bags)
  13.  
  14.     if bagWeight < 10 {
  15.         priceBagOver20kg /= 5
  16.     } else if bagWeight <= 20 {
  17.         priceBagOver20kg /= 2
  18.     }
  19.  
  20.     if days < 7 {
  21.         priceBagOver20kg *= 1.40
  22.     } else if days <= 30 {
  23.         priceBagOver20kg *= 1.15
  24.     } else {
  25.         priceBagOver20kg *= 1.10
  26.     }
  27.    
  28.     totalPrice := priceBagOver20kg * float64(bags)
  29.     fmt.Printf("The total price of bags is: %.2f lv.\n", totalPrice)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement