Skip to content

Instantly share code, notes, and snippets.

@aasumitro
Created October 18, 2022 07:14
Show Gist options
  • Select an option

  • Save aasumitro/b350a5b5b251bbd856f0fe870bfcab70 to your computer and use it in GitHub Desktop.

Select an option

Save aasumitro/b350a5b5b251bbd856f0fe870bfcab70 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner inputDetik = new Scanner(System.in);
System.out.print("Masukkan Detik: ");
int detikInputan = Integer.parseInt(inputDetik.nextLine());
Main main = new Main();
String result = main.calculate(detikInputan);
System.out.println(result);
}
private String calculate(int detikInputan) {
int S = detikInputan % 60;
int H = detikInputan / 60;
int M = H % 60;
H = H / 60;
return H + ":" + M + ":" + S;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment