diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-02-02 13:22:53 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-02-02 13:22:53 -0500 |
commit | f02ac2c933a33a363035ae478071759f87048e92 (patch) | |
tree | a59432de5e4018a4280b151c8db9cd91925d91db |
added timer
-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; +} |