2. Write a program in java that accepts the seconds as input and converts them into the corresponding number of hours
minutes and seconds.
Answers
Answered by
4
Answer:
import java.util.*;
public class Question {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Time in seconds: ");
int seconds = in.nextInt();
int s = seconds % 60;
int h = seconds / 60;
int m = h % 60;
h = h / 60;
System.out.print( h + " Hour " + m + " Minutes " + s+ " Seconds");
System.out.print("\n");
}
}
Similar questions
Social Sciences,
5 months ago
Social Sciences,
5 months ago
Science,
10 months ago
Math,
10 months ago