From 7f76e58e1e6fc44d835073fbd8fdde28d5e206b6 Mon Sep 17 00:00:00 2001 From: imnyang Date: Tue, 31 Mar 2026 09:16:35 +0900 Subject: [PATCH] wow --- 02/02_33p.c | 5 ----- 02/02_55p.c | 11 +++++++++++ 02/02_56p.c | 21 +++++++++++++++++++++ 02/02_57p.c | 17 +++++++++++++++++ 02/02_60p.c | 13 +++++++++++++ 02/02_61p.c | 15 +++++++++++++++ 02/02_62p.c | 11 +++++++++++ 02/02_63p.c | 15 +++++++++++++++ 02/02_68p.c | 17 +++++++++++++++++ 02/02_69p.c | 30 ++++++++++++++++++++++++++++++ 10 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 02/02_55p.c create mode 100644 02/02_56p.c create mode 100644 02/02_57p.c create mode 100644 02/02_60p.c create mode 100644 02/02_61p.c create mode 100644 02/02_62p.c create mode 100644 02/02_63p.c create mode 100644 02/02_68p.c create mode 100644 02/02_69p.c diff --git a/02/02_33p.c b/02/02_33p.c index 2d5c8d8..4483d41 100644 --- a/02/02_33p.c +++ b/02/02_33p.c @@ -12,10 +12,5 @@ int main() { printf("char: %zu bytes\n", sizeof(char)); - char ch = 'A'; - printf("\n%c %d", ch, ch); - ch += 32; - printf("\n%c %d", ch, ch); - return 0; } diff --git a/02/02_55p.c b/02/02_55p.c new file mode 100644 index 0000000..4e5203f --- /dev/null +++ b/02/02_55p.c @@ -0,0 +1,11 @@ +#include + +int main() { + char str; + printf("영문자 입력 : "); + scanf("%c", &str); + + printf("입력한 문자는 '%c'이고\n", str); + printf("ASCII 코드 값은 %d입니다.\n", str); + return 0; +} \ No newline at end of file diff --git a/02/02_56p.c b/02/02_56p.c new file mode 100644 index 0000000..3d784c6 --- /dev/null +++ b/02/02_56p.c @@ -0,0 +1,21 @@ +#include +#include + +int main() { + char name[100]; + char school[100]; + char department[100]; + + printf("이름 : "); + scanf("%s", name); + getchar(); // consume newline + printf("학교 : "); + fgets(school, sizeof(school), stdin); + school[strcspn(school, "\n")] = '\0'; // remove newline from school + printf("학과 : "); + scanf("%s", department); + + printf("%s\n%s\n%s님 안녕하세요?\n", school, department, name); + + return 0; +} \ No newline at end of file diff --git a/02/02_57p.c b/02/02_57p.c new file mode 100644 index 0000000..de49708 --- /dev/null +++ b/02/02_57p.c @@ -0,0 +1,17 @@ +#include + +int main() { + int A; + int B; + + printf("정수 A : "); + scanf("%d", &A); + printf("정수 B : "); + scanf("%d", &B); + + printf("정수 A와 B의\n"); + printf("합 : %d\n", A + B); + printf("평균 : %.f\n", (A + B) / 2.0); + + return 0; +} \ No newline at end of file diff --git a/02/02_60p.c b/02/02_60p.c new file mode 100644 index 0000000..cf7dd61 --- /dev/null +++ b/02/02_60p.c @@ -0,0 +1,13 @@ +#include + +int main() { + char some[20]; + printf("문자열 입력 : "); + scanf("%s", some); + printf("[출력결과]\n"); + for (int i = 0; i < 4; i++) { + printf("%c", some[i]); + } + + return 0; +} \ No newline at end of file diff --git a/02/02_61p.c b/02/02_61p.c new file mode 100644 index 0000000..ba5486a --- /dev/null +++ b/02/02_61p.c @@ -0,0 +1,15 @@ +#include + +int main() { + int A, B; + + printf("정수 A : "); + scanf("%d", &A); + printf("정수 B : "); + scanf("%d", &B); + + printf("정수 A / B 결과 출력(지수형)\n"); + printf("%.2e\n", (double)A / B); + + return 0; +} \ No newline at end of file diff --git a/02/02_62p.c b/02/02_62p.c new file mode 100644 index 0000000..d30b769 --- /dev/null +++ b/02/02_62p.c @@ -0,0 +1,11 @@ +#include + +int main() { + double yard; + printf("야드 (yard) 입력 : "); + scanf("%lf", &yard); + printf("[출력결과]\n"); + printf("%.1lfyard=>%.1lfcm\n", yard, yard * 91.44); + + return 0; +} \ No newline at end of file diff --git a/02/02_63p.c b/02/02_63p.c new file mode 100644 index 0000000..d764955 --- /dev/null +++ b/02/02_63p.c @@ -0,0 +1,15 @@ +#include +#include + +int main() { + int num; + + printf("10진수 입력 : "); + scanf("%d", &num); + + printf("\n[출력결과]\n\n"); + printf("1. 8진수 : %o\n", num); + printf("2. 16진수 : %X\n", num); + + return 0; +} \ No newline at end of file diff --git a/02/02_68p.c b/02/02_68p.c new file mode 100644 index 0000000..08bd097 --- /dev/null +++ b/02/02_68p.c @@ -0,0 +1,17 @@ +#include +#include + +int main() { + int a = 1; + int b = 2; + + printf("a: %d b: %d\n", a, b); + + int temp = a; + a = b; + b = temp; + + printf("a: %d b: %d", a, b); + + return 0; +} \ No newline at end of file diff --git a/02/02_69p.c b/02/02_69p.c new file mode 100644 index 0000000..5d502bd --- /dev/null +++ b/02/02_69p.c @@ -0,0 +1,30 @@ +#include +#include + +#define C 1046.502 +#define D 1108.731 +#define E 1318.510 +#define F 1396.913 +#define G 1567.982 +#define A 1760.000 +#define B 1975.533 + +int main() { + int notes[] = { + G, G, A, A, G, G, E, G, G, E, E, D, + G, G, A, A, G, G, E, G, E, D, E, C + }; + int noteDelays[] = { + 200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 500, + 200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 500 + }; + int i; + + for (i = 0; i < (int)(sizeof(notes) / sizeof(notes[0])); i++) { + Beep(notes[i], 500); + Sleep(noteDelays[i]); + } + + system("pause"); + return 0; +} \ No newline at end of file