Seconds in N Days
Easyjava
Declare final int SECONDS_PER_DAY = 86400; and use it to convert a number of days to seconds.
Input: one whole number — the number of days.
Output: one line — the total number of seconds.
Example 1
Input
2
Output
172800
- 0 <= days <= 1000000
Hint 1
Read days as long so the multiplication does not overflow.
Hint 2
Total seconds = days * SECONDS_PER_DAY.
86400 is a fixed fact (seconds in a day), so it belongs in a final constant with a clear name. Reading days as long keeps large results (like a million days) correct.