Computer Science, asked by rajeshkumarsinghb, 10 months ago


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 dattarajshinde44
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