c6
This commit is contained in:
parent
0fe9a5ef19
commit
397409d0ad
14
C6/ex2.c
Normal file
14
C6/ex2.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
unsigned int a = 60;
|
||||||
|
unsigned int b = 13;
|
||||||
|
unsigned int r;
|
||||||
|
|
||||||
|
r = a & b;
|
||||||
|
printf("bitwise AND of 60 and 13: %d\n", r);
|
||||||
|
r = a | b;
|
||||||
|
printf("bitwise OR of 60 and 13: %d\n", r);
|
||||||
|
r = a ^ b;
|
||||||
|
printf("bitwise XOR of 60 and 13: %d\n", r);
|
||||||
|
}
|
14
C6/ex3.c
Normal file
14
C6/ex3.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
unsigned int a = 0x60;
|
||||||
|
unsigned int b = 0x13;
|
||||||
|
unsigned int r;
|
||||||
|
|
||||||
|
r = a & b;
|
||||||
|
printf("bitwise AND of 0x60 and 0x13: 0x%02x\n", r);
|
||||||
|
r = a | b;
|
||||||
|
printf("bitwise OR of 0x60 and 0x13: 0x%02x\n", r);
|
||||||
|
r = a ^ b;
|
||||||
|
printf("bitwise XOR of 0x60 and 0x13: 0x%02x\n", r);
|
||||||
|
}
|
Reference in New Issue
Block a user