This commit is contained in:
암냥 2026-04-18 22:25:36 +09:00
commit 6fef06ae70
No known key found for this signature in database
67 changed files with 436 additions and 1 deletions

33
04/ex10.c Normal file
View file

@ -0,0 +1,33 @@
#include <stdio.h>
int main() {
int a,b;
char operator;
printf("<두 개의 정수와 사칙연산자 입력>\n");
printf("정수 2개 입력 : ");
scanf("%d %d", &a, &b);
printf("연산자입력(+, -, *, /) : ");
scanf(" %c", &operator);
printf("%d %c %d를 수행합니다.\n", a, operator, b);
printf("결과 : ");
switch (operator) {
case '+':
printf("%d", a + b);
break;
case '-':
printf("%d", a - b);
break;
case '*':
printf("%d", a * b);
break;
case '/':
printf("%.1lf", a / (double)b);
break;
default:
printf("잘못된 연산자입니다.\n");
break;
}
}