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();
- public static String convertTime(int totalSeconds){
- int hours = totalSeconds / (60*60);
- totalSeconds -= hours*60*60;
- int minutes = totalSeconds/60;
- totalSeconds -= minutes*60;
- String.format("%01d:%01d:%01d",hours, minutes, totalSeconds);
- System.out.println(String.format("%01d:%01d:%01d",hours, minutes, totalSeconds));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement