write a program in java to input the time in minutes and convert and display into hours and minutes and total seconds along with variable list
Answers
Answered by
1
import java.util.Scanner;
public class KboatTime
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Time in seconds: ");
int inputTime = in.nextInt();
int hrs = inputTime / 3600;
int mins = (inputTime % 3600) / 60;
int secs = (inputTime % 3600) % 60;
System.out.println(hrs
+ " Hours "
+ mins
+ " Minutes "
+ secs
+ " Seconds");
}
}
OUTPUT
Similar questions