Write a Java program to convert seconds to hour, minute and seconds.


 /* Write a Java program to convert seconds to hour, minute and seconds.

Sample Output:

Input seconds: 86399

23:59:59 */

import java.util.*;

class Fifth

{

public static void main(String arg[])

{

Scanner obj = new Scanner(System.in);

int sec, hour, min, no;

int x;


System.out.print("\nEnter seconds : ");

no = obj.nextInt();


x = no/ 60;

hour = x / 60;

min = x - (hour*60);

sec = no - ((hour*60)*60) - (min * 60);


System.out.println("\n Time : " + hour + ":" + min + ":" + sec );

}

}

More Information on our channel Programmer Community

please like , share and subscribe to get notifications of new videos....

To understand this program video will coming soon on our you tube channel


Comments

Popular posts from this blog

Design and Develop a java program to read marks of a student and print the total and average of marks using scanner class.

Write a Java program to print the ascii value of a given character.