//练习107653秒是几天几小时几分钟几秒?
int seconds = 107653;
int day = seconds / (3600 * 24);
int mod = seconds%(3600 * 24);
int hour = mod / 3600;
mod = mod % 3600;
int minute = mod / 60;
int min = mod % 60;
Console.WriteLine("{0}秒是{1}天{2}小时{3}分钟{3}秒",seconds,day,hour,minute,min);
Console.ReadKey();
输出结果为:1天5小时54分钟54秒
对对:L
请教一下如何将帖子状态更改为已解决呢作者: 戴鑫凯 时间: 2013-2-24 15:44
//练习107653秒是几天几小时几分钟几秒?
int seconds = 107653;
int day = seconds / (3600 * 24);
int mod = seconds%(3600 * 24);
int hour = mod / 3600;
mod = mod % 3600;
int minute = mod / 60;
int min = mod % 60;
Console.WriteLine("{0}秒是{1}天{2}小时{3}分钟{4}秒",seconds,day,hour,minute,min);
Console.ReadKey();
... Console.WriteLine();那错了作者: dbqwaii 时间: 2013-2-25 11:21
Console.WriteLine("{0}秒是{1}天{2}小时{3}分钟{3}秒",seconds,day,hour,minute,min); 为什么会有两个{3} 这里错了