Skip to content

Instantly share code, notes, and snippets.

@spukles
Created September 21, 2022 17:44
Show Gist options
  • Save spukles/933ad26759c3b3c3c9626391d4a496fb to your computer and use it in GitHub Desktop.
Save spukles/933ad26759c3b3c3c9626391d4a496fb to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class timecal {
//Main Method
public static void main(String[] args){
//Create a Scanner Object
Scanner sc=new Scanner(System.in);
//Receive inputs
System.out.println("Enter Seconds: ");
//Compute int x1, x2, x3
int sec=sc.nextInt();
int x1=sec%60;
int x2=sec/60;
int x3=x2%60;
x2=x2/60;
//display result
System.out.println("HH:MM:SS- "+x2+":"+x3+":"+x1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment