Advertisement
Spocoman

Spaceship

Oct 13th, 2024
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.59 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var width, length, height, averageHeight float64
  7.     fmt.Scanln(&width)
  8.     fmt.Scanln(&length)
  9.     fmt.Scanln(&height)
  10.     fmt.Scanln(&averageHeight)
  11.    
  12.     spaceshipVolume := width * length * height
  13.     astronautVolume := (averageHeight + 0.4) * 2 * 2
  14.     team := int(spaceshipVolume / astronautVolume)
  15.  
  16.     if team < 3 {
  17.         fmt.Println("The spacecraft is too small.")
  18.     } else if team > 10 {
  19.         fmt.Println("The spacecraft is too big.")
  20.     } else {
  21.         fmt.Printf("The spacecraft holds %d astronauts.", team)
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement