Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.wausoft.core
- import scala.util.Try
- object Program extends App {
- print("Please enter a number of seconds: ")
- val time = Try(Console.readInt) getOrElse 0
- val secondsInHour = 3600
- val secondsInMinute = 60
- val hours = time / secondsInHour
- val minutes = (time % secondsInHour) / secondsInMinute
- val seconds = time % secondsInMinute
- println(s"h: $hours, m: $minutes, s: $seconds")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement