Advertisement
Spocoman

Movie Day

Oct 11th, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.60 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "math"
  6. )
  7.  
  8. func main() {
  9.     var movieTime, scenes, sceneTime int
  10.     fmt.Scanln(&movieTime)
  11.     fmt.Scanln(&scenes)
  12.     fmt.Scanln(&sceneTime)
  13.    
  14.     totalTime := 0.15 * float64(movieTime) + float64(scenes) * float64(sceneTime)
  15.  
  16.     if totalTime >= float64(movieTime) {
  17.         fmt.Printf("Time is up! To complete the movie you need %d minutes.", int(math.Round(totalTime - float64(movieTime))))
  18.     } else {
  19.         fmt.Printf("You managed to finish the movie on time! You have %d minutes left!", int(math.Round(float64(movieTime) - totalTime)))
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement