Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var fuel string
- fmt.Scanln(&fuel)
- var liters float64
- fmt.Scanln(&liters)
- var card string
- fmt.Scanln(&card)
- var literPrice = 0.0
- if (card == "No") {
- if (fuel == "Gas") {
- literPrice = 0.93
- } else if (fuel == "Gasoline") {
- literPrice = 2.22
- } else if (fuel == "Diesel") {
- literPrice = 2.33
- }
- } else {
- if (fuel == "Gas") {
- literPrice = 0.85
- } else if (fuel == "Gasoline") {
- literPrice = 2.04
- } else if (fuel == "Diesel") {
- literPrice = 2.21
- }
- }
- if (liters >= 20 && liters <= 25) {
- literPrice *= 0.92
- } else if (liters > 25) {
- literPrice *= 0.90
- }
- fmt.Printf("%.2f lv.\n", literPrice * liters)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement