Advertisement
grodek118

Time Calculator

Sep 25th, 2022 (edited)
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int seconds;
  10.         int minutes;
  11.         int hours;
  12.         int days;
  13.  
  14.         seconds = scanner.nextInt();
  15.  
  16.         if (seconds >= 86400)
  17.         {
  18.             days = seconds / 86400;
  19.             System.out.println("Number of days in that many seconds " + days);
  20.         }
  21.         else if (seconds >= 3600)
  22.         {
  23.             hours = seconds / 3600;
  24.             System.out.println("Number of hours in that many seconds: " + hours);
  25.         }
  26.         else if (seconds >= 60) {
  27.             minutes = seconds / 60;
  28.             System.out.println("Number of minutes in that many seconds: " + minutes);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement