Computer Science, asked by anirudhchhatwa2548, 8 months ago

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