From 397409d0ada426652bf801b98e74ce7905f9bc3f Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Fri, 6 Oct 2023 13:21:32 +0100 Subject: [PATCH] c6 --- C6/ex2.c | 14 ++++++++++++++ C6/ex3.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 C6/ex2.c create mode 100644 C6/ex3.c 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); +}