Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Seconds {
  4.  
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7.  
  8. int secInp;
  9. int convDays, convHours, convMinutes, convSeconds;
  10.  
  11. System.out.println("Please enter the seconds to convert: ");
  12. secInp = input.nextInt();
  13.  
  14. convDays = secInp / 86400;
  15. convHours = (secInp % 86400 ) / 3600;
  16. convMinutes = ( (secInp % 86400) % 3600 ) / 60;
  17. convSeconds = ( (secInp % 86400 ) % 3600) % 60;
  18.  
  19. System.out.println("You entered: " + secInp + " seconds this calculates to: ");
  20. System.out.print(" Days: " + convDays + " Hours: " + convHours + " Minutes: " + convMinutes + " convSeconds: " + convSeconds);
  21.  
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement