aboutsummaryrefslogtreecommitdiff
path: root/qna/gggg123.c
diff options
context:
space:
mode:
authorDavid Timber <dxdt@dev.snart.me>2024-11-12 05:57:44 +0100
committerDavid Timber <dxdt@dev.snart.me>2024-11-12 05:57:44 +0100
commit5fc6f750a207a9918c33f050409feae9f3dd3166 (patch)
treecf2c18b9ebb5c7c3cfefb1271696f97eda20eaef /qna/gggg123.c
parentbe3b15d64e9f6b8c2489b296c7f4b63487aa5564 (diff)
Dump some files from personal directory
Diffstat (limited to 'qna/gggg123.c')
-rw-r--r--qna/gggg123.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/qna/gggg123.c b/qna/gggg123.c
new file mode 100644
index 0000000..b776e4e
--- /dev/null
+++ b/qna/gggg123.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+int main()
+
+{
+ int x, y, z; //정수 변수 정의
+ scanf("%d %d %d", &x, &y, &z); //x, y, z 입력
+ int xh, yh, zh; //각 변수의 백의 자리수에 대한 변수 정의
+ xh = x/100; //x 백의 자리수
+ yh = y/100; //y 백의 자리수
+ zh = z/100; //z 백의 자리수
+
+ char ch[3];
+
+ // 각 수의 백의 자리수가 모두 같으면 T
+ ch[0] = 'T' * (xh == yh && yh == zh);
+ // 두 수의 백의 자리수만 같으면 D
+ ch[1] =
+ 'D' *
+ (ch[0] == 0) * /* 근데 모두 같으면 출력하면 안 됨 */
+ (xh == yh || yh == zh || zh == xh);
+ // 백의 자리수가 모두 다르면 S
+ ch[2] = 'S' * (xh != yh && yh != zh && zh != xh);
+
+ //T,D,S를 입력받는 변수 ch를 정의하고 각 조건에 맞는 문자를 대입(조건이 거짓이면 0을 곱해서 무효처리)
+ printf("%c%c%c\n", ch[0], ch[1], ch[2]); //ch 출력
+
+ return 0;
+}