Computer Science, asked by veerankikarthikeya, 11 months ago

WAP to input the time in seconds. Display time after converting them into hours,minutes and seconds. sample input:time in sec 5420,sample output:1 hour 30 minute 20 seconds

Answers

Answered by devdarshanpatra4
19

import java.util.*;

public class timecondev {

public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

       System.out.print("Input seconds: ");

 int seconds = in.nextInt();  

       int p1 = seconds % 60;

       int p2 = seconds / 60;

       int p3 = p2 % 60;

       p2 = p2 / 60;

       System.out.print( p2 + ":" + p3 + ":" + p1);

 System.out.print("\n");

   }    

}

Similar questions