#include <stdio.h> #include <conio.h> void main() { int i = 5,j = 6; printf("%d", i | j); getch(); }</blockquote> What is output ?

Huyền Trang

New member
#include <stdio.h>
#include <conio.h>
void main()
{
int i = 5,j = 6;
printf("%d", i | j);
getch();
}</blockquote>
What is output ?
A. 7
B. 6
C. 5
D. 1
 
Hướng dẫn
Chọn A là đáp án đúng
Xem lời giải
Xem lời giải
i = 5 = 101 (hệ nhị phân), j = 6 = 110 (hệ nhị phân). Phép toán | là phép toán OR bit. i|j = 111 = 7.