#include <stdio.h>
int main() {
int a = 10;
printf("a는 %d\n", a);
a = a + 2;
printf("a는 %d\n", a);
a += 2;
printf("a는 %d\n", a);
a++; // ++ : 변수에 1을 더해서 다시 변수에 넣는다
printf("a는 %d\n", a);
a--; // -- : 변수에 1을 빼서 다시 변수에 넣는다
printf("a는 %d\n", a);
int b = 20;
printf("b는 %d\n", ++b); //전위
printf("b는 %d\n", b++); //후위
printf("b는 %d\n", b);
int c = 30;
printf("c는 %d\n", --c); //1.빼기1 계산 2.printf
printf("c는 %d\n", c--); //1.printf 2.빼기1 계산
printf("c는 %d\n", c);
printf("----문제1----\n");
int x = 5;
printf("x = %d\n", x);
x += 3; // += 복합 대입 연산자
printf("x = %d\n", x);
x = x + 1; // 일반 덧셈
printf("x = %d\n", x);
printf("----문제2----\n");
int y = 7;
printf("y = %d\n", ++y);
printf("y = %d\n", y++);
printf("y = %d\n", y);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: