Advertisement
Spocoman

07. Fuel Tank

Sep 17th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.50 KB | None | 0 0
  1. package main
  2. import (
  3.     "fmt"
  4.     "strings"
  5. )
  6.  
  7. func main() {
  8.     var fuel string
  9.     fmt.Scanln(&fuel)
  10.    
  11.     var liters float64
  12.     fmt.Scanln(&liters)
  13.    
  14.     if (fuel == "Diesel" || fuel == "Gasoline" || fuel == "Gas") {
  15.         if (liters >= 25) {
  16.             fmt.Printf("You have enough %s.\n", strings.ToLower(fuel))
  17.         } else {
  18.             fmt.Printf("Fill your tank with %s!\n", strings.ToLower(fuel))
  19.         }
  20.     } else {
  21.         fmt.Println("Invalid fuel!")
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement