Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var hourExam, minuteExam, hourStudent, minuteStudent int
- fmt.Scanln(&hourExam)
- fmt.Scanln(&minuteExam)
- fmt.Scanln(&hourStudent)
- fmt.Scanln(&minuteStudent)
- var examMinutes = hourExam * 60 + minuteExam
- var studentMinutes = hourStudent * 60 + minuteStudent
- var time = int(math.Abs(float64(studentMinutes) - float64(examMinutes)))
- if (studentMinutes > examMinutes) {
- fmt.Println("Late")
- if (time < 60) {
- fmt.Printf("%d minutes after the start", time)
- } else {
- fmt.Printf("%d:%02d hours after the start", time / 60, time % 60)
- }
- } else {
- if (time <= 30) {
- fmt.Println("On time")
- } else {
- fmt.Println("Early")
- }
- if (time != 0) {
- if (time < 60) {
- fmt.Printf("%d minutes before the start", time)
- } else {
- fmt.Printf("%d:%02d hours before the start", time / 60, time % 60)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement