commit 1016360b456a1967c63f59efaa5183950d9cde7a
parent 8d5b388a5475e8482c054e4d9baf29b4eacfdbba
Author: Amit Dutta <amitdutta4255@gmail.com>
Date: Mon, 15 Sep 2025 19:45:51 +0530
Add files via upload
Diffstat:
6 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/tution-c/APC-SPS-003.c b/tution-c/APC-SPS-003.c
@@ -0,0 +1,11 @@
+/* Bitwise AND '&' */
+
+#include<stdio.h>
+int main() {
+ unsigned int a = 4, b = 5, c = 6;
+ unsigned int x, y;
+ x = a & b;
+ y = b & c;
+ printf("x = %u y = %u", x, y);
+ return 0;
+}
diff --git a/tution-c/APC-SPS-004.c b/tution-c/APC-SPS-004.c
@@ -0,0 +1,8 @@
+#include<stdio.h>
+int main() {
+ int x = 25, y = 19, z;
+ z = x - y;
+ z = z & x ;
+ printf("Z = %d", z);
+ return 0;
+}
diff --git a/tution-c/APC-SPS-005.c b/tution-c/APC-SPS-005.c
@@ -0,0 +1,13 @@
+/* Bitwise OR '|' */
+
+#include<stdio.h>
+int main() {
+ int x = 12, y = 14, z = 10, res;
+ x++;
+ z++;
+ x = x + y + z;
+ res = x | y;
+ z = res | z;
+ printf("x = %d y = %d z = %d res = %d", x, y, z, res);
+ return 0;
+}
diff --git a/tution-c/APC-SPS-006.c b/tution-c/APC-SPS-006.c
@@ -0,0 +1,12 @@
+/* Bitwise NOT '~' */
+
+#include<stdio.h>
+int main() {
+ int x = 12, y = 15, z = 21;
+ int res, res1, res2;
+ res = x > 10;
+ res1 = ~res;
+ res2 = ~x;
+ printf("REs = %d, Res1 = %d, Res2 = %d", res, res1, res2);
+ return 0;
+}
diff --git a/tution-c/APC-SPS-007.c b/tution-c/APC-SPS-007.c
@@ -0,0 +1,16 @@
+/* WAP to check a number is even or odd using bitwise operator */
+
+#include<stdio.h>
+int main() {
+ int x, res = 1;
+ printf("Enter a number : ");
+ scanf("%d", &x);
+ res = res & x;
+ if (res == 0) {
+ printf("\nInput %d is a even number.", x);
+ }
+ else {
+ printf("\nInput %d is a odd number.", x);
+ }
+ return 0;
+}
diff --git a/tution-c/APC-SPS-008.c b/tution-c/APC-SPS-008.c
@@ -0,0 +1,13 @@
+/* WAP to calculate area of circle by accepting radius as input */
+/* Author : Amit Dutta, Date : 15th September, 2025 */
+
+#include<stdio.h>
+#include<math.h>
+int main() {
+ double r, area;
+ printf("Enter the radius of circle : ");
+ scanf("%lf", &r);
+ area = M_PI * r * r;
+ printf("\nArea : %lf", area);
+ return 0;
+}