Advertisement
Spocoman

Easter Lunch

Oct 8th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.82 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var easterBreads, eggPacks, cookiesPerKg int
  7.     fmt.Scanln(&easterBreads)
  8.     fmt.Scanln(&eggPacks)
  9.     fmt.Scanln(&cookiesPerKg)
  10.    
  11.     easterBreadsPrice := float64(easterBreads) * 3.20
  12.     eggPacksPrice := float64(eggPacks) * 4.35
  13.     dyeingEggsPrice := float64(eggPacks) * 12 * 0.15
  14.     cookiesPrice := float64(cookiesPerKg) * 5.40
  15.    
  16.     sum := easterBreadsPrice + eggPacksPrice + dyeingEggsPrice + cookiesPrice
  17.    
  18.     fmt.Printf("%.2f\n", sum)
  19. }
  20.  
  21. ИЛИ:
  22.  
  23. package main
  24.  
  25. import "fmt"
  26.  
  27. func main() {
  28.     var easterBreads, eggPacks, cookiesPerKg float64
  29.     fmt.Scanln(&easterBreads)
  30.     fmt.Scanln(&eggPacks)
  31.     fmt.Scanln(&cookiesPerKg)
  32.    
  33.     fmt.Printf("%.2f\n", easterBreads * 3.20 + eggPacks * 4.35 + eggPacks * 12 * 0.15 + cookiesPerKg * 5.40)
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement