Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var budget float64
- fmt.Scanln(&budget)
- var gpu, cpu, ram int
- fmt.Scanln(&gpu)
- fmt.Scanln(&cpu)
- fmt.Scanln(&ram)
- var gpuPrice = float64(gpu) * 250
- var cpuPrice = float64(cpu) * gpuPrice * 0.35
- var ramPrice = float64(ram) * gpuPrice * 0.10
- var totalAmount = gpuPrice + cpuPrice + ramPrice
- if (gpu > cpu) {
- totalAmount *= 0.85
- }
- if (budget >= totalAmount) {
- fmt.Printf("You have %.2f leva left!", budget - totalAmount)
- } else {
- fmt.Printf("Not enough money! You need %.2f leva more!", totalAmount - budget)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement