forked from MAYANK25402/Hactober-2023-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdigitalClock.c
44 lines (34 loc) · 1.02 KB
/
digitalClock.c
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
#include <stdio.h>
int main() {
printf("Welcome\n");
int hour_hand, minute_hand, phase;
printf("\n\aMORNING PHASE = 1 \nwhile \nEVENING PHASE = 2\n\n");
printf("WHICH PHASE OF DAY IT IS:\n\a\n");
scanf("%d", &phase);
switch (phase) {
case 1:
printf("Enter the number that hour hand passed\n");
scanf("%d", &hour_hand);
printf("Enter the number that minute hand passed\n");
scanf("%d", &minute_hand);
if (hour_hand < 13 && minute_hand < 13) {
printf("The time according to your inputs is %d:%d AM\n", hour_hand,
5 * minute_hand);
}
break;
case 2:
printf("Enter the number that hour hand passed\n");
scanf("%d", &hour_hand);
printf("Enter the number that minute hand passed\n");
scanf("%d", &minute_hand);
if (hour_hand < 13 && minute_hand < 13) {
printf("The time according to your inputs is %d:%d PM\n", hour_hand,
5 * minute_hand);
}
break;
default:
printf("Please enter valid numbers..!");
break;
}
return 0;
}