-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.c
More file actions
53 lines (41 loc) · 1.02 KB
/
Copy pathtimer.c
File metadata and controls
53 lines (41 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdio.h>
#include <Windows.h>
#include <time.h>
int main(){
int pilihan;
printf("---| TIMER |---\n");
printf("1). Seconds\n2). Minutes\n3). Hours\n4. EXIT");
printf("\n>>>: ");
scanf("%d", &pilihan);
getchar();
int time;
int play = 0;
if(pilihan != 4){
play = 1;
printf("\n--| SECONDS |--\n");
printf("How much: ");
scanf("%d", &time);
printf("-----------\n");
printf("\n");
if(pilihan == 1){
time = time;
}
else if(pilihan == 2){
time *= 60;
}
else if(pilihan == 3){
time *= 3600;
}
}
while(time > 0){
int hours = time / 3600;
int minutes = (time % 3600) / 60;
int seconds = time % 60;
printf("\r%02d:%02d:%02d", hours, minutes, seconds);
fflush(stdout);
time--;
Sleep(1000);
}
printf("\r--TIMES UP!--");
return 0;
}