Advertisement
Spocoman

06. Speed Info

Sep 16th, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.88 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var speed float32
  6.     fmt.Scanln(&speed)
  7.    
  8.     if (speed <= 10) {
  9.         fmt.Println("slow")
  10.     } else if (speed <= 50) {
  11.         fmt.Println("average")
  12.     } else if (speed <= 150) {
  13.         fmt.Println("fast")
  14.     } else if (speed <= 1000) {
  15.         fmt.Println("ultra fast")
  16.     } else if (speed > 1000) {
  17.         fmt.Println("extremely fast")
  18.     }
  19. }
  20.  
  21. ИЛИ:
  22.  
  23. package main
  24. import "fmt"
  25.  
  26. func main() {
  27.     var speed float32
  28.     fmt.Scanln(&speed)
  29.    
  30.     var result = ""
  31.    
  32.     if (speed <= 10) {
  33.         result = "slow"
  34.     } else if (speed <= 50) {
  35.         result = "average"
  36.     } else if (speed <= 150) {
  37.         result = "fast"
  38.     } else if (speed <= 1000) {
  39.         result = "ultra fast"
  40.     } else if (speed > 1000) {
  41.         result = "extremely fast"
  42.     }
  43.    
  44.     fmt.Println(result)
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement