怎么样用c语言写一个倒计时程序
如题,怎么写啊!想了一天也没想到怎么写
#include<stdio.h> #include<windows.h>//Sleep(),system() int main(void) { int min,sec,n; printf("Input min:"); scanf("%d",&min); printf("Input sec:"); scanf("%d",&sec); n=60*min+sec; getchar(); printf("按回车开始计时。"); while(getchar()!='\n') { } system("cls"); while(n!=0) { printf("%2d:%2d",n/60,n%60); n=n-1; Sleep(1000); system("cls"); } printf("Time is over.\n"); return 0; }