-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ5.c
More file actions
49 lines (42 loc) ยท 834 Bytes
/
Q5.c
File metadata and controls
49 lines (42 loc) ยท 834 Bytes
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
// Lab01-5 : ์๋
์์ผ ์ถ๋ ฅ
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void year(int y, char* num) {
if (y > 21 && y < 100) {
printf("19%c%c๋
", num[0], num[1]);
}
else {
printf("20%c%c๋
", num[0], num[1]);
}
}
void month(int m, char* num) {
if (m < 10) {
printf("%c์ ", num[3]);
}
else {
printf("%c%c์ ", num[2], num[3]);
}
}
void day(int d, char* num) {
if (d < 10) {
printf("%c์ผ์์
๋๋ค.\n", num[5]);
}
else {
printf("%c%c์ผ์์
๋๋ค.\n", num[4], num[5]);
}
}
void main() {
while (1) {
int birthy, birthm, birthd;
char num[7];
printf("์ฃผ๋ฏผ๋ฒํธ ์์๋ฆฌ : ");
scanf("%s", num);
//528 = '0' * 11;
birthy = num[0] * 10 + num[1] - 528;
birthm = num[2] * 10 + num[3] - 528;
birthd = num[4] * 10 + num[5] - 528;
year(birthy, num);
month(birthm, num);
day(birthd, num);
}
}