编程实现107653秒是几天几小时几分钟几秒 用java编写

如题所述

编程实现107653是几天几小时几分钟几秒,主要是使用60进制,如下实例:

package com.qiu.lin.he;


public class CeShi {

public static void main(String[] args) {

int str = 107653;
System.out.print(str / (24 * 60 * 60) + "天");
System.out.print(str % (24 * 60 * 60) / (60 * 60) + "小时");
System.out.print(str % (24 * 60 * 60) % (60 * 60) / 60 + "分钟");
System.out.print(str % (24 * 60 * 60) % (60 * 60) % 60 + "秒");
}
}

运行结果如下:

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-01-14
好普通的除法计算!
1天有多少秒,先计算出天数。再计算小时、分钟、秒。
第2个回答  2013-01-14
int str = 107653;
System.out.print(str / (24 * 60 * 60) + "天");
System.out.print(str % (24 * 60 * 60) / (60 * 60) + "小时");
System.out.print(str % (24 * 60 * 60) % (60 * 60) / 60 + "分钟");
System.out.print(str % (24 * 60 * 60) % (60 * 60) % 60 + "秒");本回答被提问者采纳