c语言:输入秒数,将它转换,用小时,分钟,秒来表示,比如说多少秒变成几时几分几秒

c语言:输入秒数,将它转换,用小时,分钟,秒来表示,比如说多少秒变成几时几分几秒

#include <stdio.h>
int main()
{
    int h,m,s;
    scanf("%d",&s);
    h=s/3600;
    m=s/60%60;
    s%=60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}
温馨提示:内容为网友见解,仅供参考
无其他回答

c语言:输入秒数,将它转换,用小时,分钟,秒来表示,比如说多少秒变成几时...
include <stdio.h>int main(){ int h,m,s; scanf("%d",&s); h=s\/3600; m=s\/60%60; s%=60; printf("%d:%d:%d\\n",h,m,s); return 0;}

用c语言读入秒数,编程,换算成几时几分几秒的形式输出
include<stdio.h>int main(){int ss, s, m, h;scanf("%d", &ss);s = ss % 60;m = ss \/ 60 % 60;h = ss \/ 3600;printf("%d:%d:%d", h, m, s);return 0;}

用c语言编程,将输入的秒数转换 t 为几小时几分几秒
&inputSeconds);\/\/定义计算后的天数,小时,分钟,秒数int day,hours,minute,second;\/\/天数:秒数除以一天所用的秒数即24*60*60得到的商就是天数day=inputSeconds\/(24*60*60);

求一个c语言程序,将输入多少秒转化为几时几分几秒
include <stdio.h>int main(void){int a, b, c, d;printf("输入多少秒");scanf("%d", &a);b = a\/3600;a = a%3600; \/\/剩下秒数c = a\/60;d = a%60; \/\/剩下秒数printf("%d时%d分%d秒\\n", b, c, d);return 0;} ...

C语言中输入一任意秒(正整数),转换成多少日多少时多少分多少秒输出
include <stdio.h>int main() {unsigned s,seconds,minites,hours,days;scanf("%u",&s);days = s \/ (24 * 3600);s %= 24 * 3600;hours = s \/ 3600;s %= 3600;minites = s \/ 60;seconds = s;printf("%d天,%d小时,%d分钟,%d秒\\n",days,hours,minites,seconds);return 0;} ...

C语言题目: 求编程:输入秒数,将它按小时,分钟,秒的形式来输出,例如输 ...
得到如下代码:include <stdio.h>int main(){int s, h, m;scanf("%d", &s);h = s \/ 3600;s %= 3600;m = s \/ 60;s %= 60;printf("%d小时%d分钟%d秒\\n", h, m, s);return 0;}

c语言,编程题 输入一个以秒为单位的时间值,将其转换为“时:分:秒...
include <stdio.h> main(){ char s[24];int sec;scanf("%d", &sec);s2hms(s,sec);printf("%s\\n",s);}s2hms(char* str, int sec){ int h,m,s;h = sec\/3600;m = sec\/60 - 60* h;s = sec - 3600* h - 60*m;sprintf(str,"%d:%d:%d",h,m,s);} ...

输入秒数,将它转换为小时,分钟,秒来表示.我这样做的.
include include <stdio.h> main(){ int s,f,m;m=7278;s=m\/3600;f=m%3600\/60;m=m%3600%60;printf("%d:%d:%d",s,f,m);} 是求余运算符 好好看看printf函数 我加“:”只是为了让它显示成时间的格式

拜求C语言程序源代码:输入一个表示秒的整数,输出与该整数相等的小时、分...
include<stdio.h> void main(){int h,m,s,v;printf("请输入一个需求转化的数:");scanf("%d",&v);printf("\\n");h=v\/3600;m=(v-h*3600)\/60;s=v-h*3600-m*60;printf("转化后为%d小时%d分钟%d秒\\n",h,m,s);printf("谢谢使用!请按任意键退出!\\n");getchar();} ...

输入秒数,将它按小时、分钟、秒的形式来输出。例如输入24680 秒,则输...
Private Sub Form_Load()Dim H As Long, M As Long, S As Long Dim SC As Long SC = 24680 H = SC \\ 3600 M = (SC - H * 3600) \\ 60 S = SC - H * 3600 - M * 60 MsgBox H & "小时" & M & "分" & S & "秒"End Sub ...

相似回答