diff options
-rw-r--r-- | timer.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +#include <stdio.h> +#include <unistd.h> + +int main(){ + int min; int sec; + printf("Input #minutes:#seconds "); + scanf("%d:%d", &min, &sec); + printf("\n"); + int time = min*60 + sec; + for (int i = 1; i<=time; i++){ + printf("%d:%02d/%d:%02d\r", (i-i%60)/60, i%60, min, sec); + fflush(stdout); + sleep(1); + } + printf("\n"); + return 0; +} |