求一个C语言写的倒计时程序,要求显示从30秒到0秒

做个倒计时程序,可以从30秒到0秒
2025-02-23 00:54:06
推荐回答(3个)
回答1:

#include
#include
main()
{
clock_t start,end;
int n;
printf("How many seconds do you want to count? ");
scanf("%d",&n);
getchar();
clrscr();
start=end=clock();
while((n-(int)(end-start)/19)>=0)
{
printf("the time is: %d",n-(int)(end-start)/19);
sleep(1);
end=clock();
clrscr();
}
}

回答2:

回答3:

老大,你上面是C语言吗?我看起来像是JS哈?