啊哈磊_编程从这里起步
标题:
输入秒数,给出时:分:秒 的格式(注:为了添加难度,设1分有61秒)
[打印本页]
作者:
非非
时间:
2018-12-21 16:19
标题:
输入秒数,给出时:分:秒 的格式(注:为了添加难度,设1分有61秒)
#include <stdio.h>
int main()
{
int n;
n=60;
printf("%d:%d:%d",n/3600,n/60%60,n%61);
system("pause");
return 0;
}
为什么不对
作者:
fantasy--
时间:
2018-12-22 00:46
你写的分钟是干嘛的?
作者:
xjzb
时间:
2018-12-23 19:28
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;//定义变量。
scanf("%d",&n);//输入秒数。
printf("%d:%d:%d",n/3660/*因为一分有61秒,所以一时有3660秒*/,n/61,n%61);
system("pause");
return 0;
}
作者:
古都人
时间:
2019-1-5 19:25
#include <stdio.h>
#include <stdlib.h>
int main()
{
int b,s=0,min=0,h=0;
scanf("%d",&b);
s=b%61;
min=((b-s)/61)%61;
h=b-s-min*61;
h=h/(61*61)%61;
printf("%d时%d分%d秒",h,min,s);
system("pause");
return 0;
}
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2