帮忙编写一个java程序(很基础的那种).Write a program which accepts a time interval in seconds and prints the equivalent time in hours minutes seconds.One hour is 3600 seconds and one minute is 60 seconds.
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 02:17:44
帮忙编写一个java程序(很基础的那种).Write a program which accepts a time interval in seconds and prints the equivalent time in hours minutes seconds.One hour is 3600 seconds and one minute is 60 seconds.
帮忙编写一个java程序(很基础的那种).
Write a program which accepts a time interval in seconds and prints the equivalent time in hours minutes seconds.One hour is 3600 seconds and one minute is 60 seconds.
帮忙编写一个java程序(很基础的那种).Write a program which accepts a time interval in seconds and prints the equivalent time in hours minutes seconds.One hour is 3600 seconds and one minute is 60 seconds.
public class TimeTran {
public static void translation(int seconds){
int hh = seconds/3600;
int mm = (seconds - hh * 3600)/60;
int ss = seconds - hh * 3600 - mm * 60;
System.out.println("时间转换之后为" + hh + "小时" + mm + "分" + ss + "秒");
}
public static void main(String[] args) {
translation(3601);
}
}