Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. package Questions;
  2. import java.util.Scanner;
  3. public class Q1 {
  4.  
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7. System.out.println("Enter time in seconds: ");
  8. int seconds = input.nextInt();
  9. int hours = seconds / (60*60);
  10. seconds -= hours*60*60;
  11. int minutes = seconds/60;
  12. seconds -= minutes*60;
  13. String.format("%20d:%20d:%20d",hours, minutes, seconds);
  14.  
  15.  
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement