Advertisement
Spocoman

Fruit Market

Oct 10th, 2024
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.60 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var strawberriesPrice, bananasKg, orangesKg, raspberriesKg, strawberriesKg float64
  7.     fmt.Scanln(&strawberriesPrice)
  8.     fmt.Scanln(&bananasKg)
  9.     fmt.Scanln(&orangesKg)
  10.     fmt.Scanln(&raspberriesKg)
  11.     fmt.Scanln(&strawberriesKg)
  12.    
  13.     raspberriesPrice := strawberriesPrice / 2
  14.     orangesPrice := raspberriesPrice * 0.60
  15.     bananasPrice := raspberriesPrice / 5
  16.     totalSum := strawberriesPrice * strawberriesKg + bananasPrice * bananasKg + orangesPrice * orangesKg + raspberriesPrice * raspberriesKg
  17.  
  18.     fmt.Printf("%.2f", totalSum)
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement