立即學習:https://edu.csdn.net/course/play/20589/257732?utm_source=blogtoedu
_______________________________________________________________________________________________________
人生碌碌,競短論長,卻不道榮枯有數,得失難忘。
_______________________________________________________________________________________________________
// 練習5:編程實現用戶輸入多少秒,然後程序轉化爲幾天幾小時幾分鐘幾秒?
Console.WriteLine("請輸入多少秒:");
string sec = Console.ReadLine();
int _sec = Convert.ToInt32(sec);
int h=_sec%(3600*24)/3600;
Console.WriteLine("{0}秒爲第{1}天{2}小時{3}分{4}秒", sec, _sec / (3600 * 24), h, _sec % (3600 * 24) % 3600 / 60, _sec % (3600 * 24) % 3600 % 60);
Console.ReadKey();