Saved Bookmarks
| 1. |
Write a program in Java to input the time in seconds. Display the time after converting them into hours, minutes and seconds using function argument. |
|
Answer» Answer: Java code: :import java.util.*; public CLASS Exercise55 { public static void main(STRING[] args) { Scanner in = new Scanner(System.in); System.out.print("Input seconds: "); INT seconds = in.nextInt(); int p1 = seconds % 60; int P2 = seconds / 60; int p3 = p2 % 60; p2 = p2 / 60; System.out.print( p2 + ":" + p3 + ":" + p1); System.out.print("\n"); } } Explanation: |
|