반응형
#include <stdio.h>

int main()
{
	int a,b;
	printf("입력: ");
	scanf("%d %d", &a, &b);
	printf("%d\n", a&b); //and 비트 연산 두개의 비트가 모두 1일때 1 
	printf("%d\n", a|b); //or 비트 두개의 비트 중 하나라도 1이면 1 
	printf("%d\n", a^b); //xor 비트 두개의 비트 중 하나만 1일때 1 
	printf("%d\n", ~a); //not 비트가 1이면 0, 0이면 1 
	printf("%d\n", a>>2); // l - shift
	printf("%d\n", a<<3); // R - shift
}
반응형

'2019~2020 > 정보 과학' 카테고리의 다른 글

scanf() 함수로 문자 읽기1  (0) 2019.03.29
printf() 함수 실습  (0) 2019.03.29
관계연산자 , 논리연산자  (0) 2019.03.22
산술 연산자  (0) 2019.03.22
문자 상수 확인하기  (0) 2019.03.20

+ Recent posts