赞
踩
- //将秒转换为时分秒:法1
- int main()
- {
- int a, b, c, d;
- scanf("%d", &a);
- d = a % 60; //秒
- b = a/3600;//小时
- c = (a-3600 * b-d) / 60;
-
- printf("%d %d %d", b, c, d);
-
-
- return 0;
- }
-
- //将秒转化为时分秒:法2
- int main() {
- int seconds, h, m, s;
- scanf("%d", &seconds);
- h = seconds / 3600;
- m = (seconds % 3600) / 60;
- s = (seconds % 3600) % 60;
- printf("%d %d %d", h, m, s);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。