Write a program to input the time in seconds. display the time after converting them into hour,minutes and seconds. input =time in second 5420 and output= 1 hour 30 minutes 20 seconds. programming for class 9 and 10th
Answers
Answered by
8
import java.util.*;
public class Exercise55 {
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");
}
}
#answerwithquality & #BAL
Similar questions