diff --git a/C6/ex2.c b/C6/ex2.c new file mode 100644 index 0000000..05994e7 --- /dev/null +++ b/C6/ex2.c @@ -0,0 +1,14 @@ +#include + +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); +} diff --git a/C6/ex3.c b/C6/ex3.c new file mode 100644 index 0000000..acc02fd --- /dev/null +++ b/C6/ex3.c @@ -0,0 +1,14 @@ +#include + +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); +}