Advertisement
Spocoman

08. Lunch Break

Sep 16th, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.67 KB | None | 0 0
  1. package main
  2. import (
  3.     "fmt"
  4.     "math"
  5. )
  6.  
  7. func main() {
  8.     var serialName string
  9.     fmt.Scanln(&serialName)
  10.    
  11.     var serialTime, breakTime int
  12.     fmt.Scanln(&serialTime)
  13.     fmt.Scanln(&breakTime)
  14.  
  15.     var neededTime = float64(breakTime) / 8.0 + float64(breakTime) / 4.0 + float64(serialTime)
  16.  
  17.     if (neededTime <= float64(breakTime)) {
  18.         fmt.Printf("You have enough time to watch %s and left with %.0f minutes free time.", serialName, float64(breakTime) - math.Floor(neededTime))
  19.     } else {
  20.         fmt.Printf("You don't have enough time to watch %s, you need %.0f more minutes.", serialName, math.Ceil(neededTime) - float64(breakTime))
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement