Wap in Java to input the time in second s. Display the time after converting them into hours, minutes and seconds.
Sample input: Time in seconds 5420
Sample output: 1 hour 30 minutes 20 seconds
Answers
Answered by
31
import java.util.*;
class anmol
{
public static void main(String args[])
{
int hr, min, s, rs;
Scanner in=new Scanner(System.in);
System.out.println("Enter seconds");
s=in.nextInt();
hr=s/(60*60);
rs=s%(60*60);
min=rs/60;
rs=rs%60;
System.out.println(hr+" Hours "+min+" Minutes "+rs+" Seconds ");
}
}
HOPE IT HELPS YOU
MARK ME AS BRAINLIEST
Similar questions
French,
7 months ago
English,
7 months ago
Math,
7 months ago
World Languages,
1 year ago
Computer Science,
1 year ago