Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Questions;
- import java.util.Scanner;
- public class Q1 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.println("Enter time in seconds: ");
- int seconds = input.nextInt();
- int hours = seconds / (60*60);
- seconds -= hours*60*60;
- int minutes = seconds/60;
- seconds -= minutes*60;
- String.format("%20d:%20d:%20d",hours, minutes, seconds);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement