Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- const(
- magnoliaPrice = 3.25
- hyacinthPrice = 4.00
- rosePrice = 3.50
- cactusPrice = 8.00
- taxProfit = 0.05
- )
- var magnoliaCount, hyacinthCount, roseCount, cactusCount int
- fmt.Scanln(&magnoliaCount)
- fmt.Scanln(&hyacinthCount)
- fmt.Scanln(&roseCount)
- fmt.Scanln(&cactusCount)
- var gift float64
- fmt.Scanln(&gift)
- var total = (magnoliaPrice * float64(magnoliaCount) + hyacinthPrice * float64(hyacinthCount)
- + rosePrice * float64(roseCount) + cactusPrice * float64(cactusCount)) * (1 - taxProfit);
- if (total >= gift){
- fmt.Printf("She is left with %d leva.", (int)(total - gift));
- } else {
- fmt.Printf("She will have to borrow %d leva.", (int)(math.Ceil(gift - total)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement