luc104.c (884B)
1 /* 2 * Author : Amit Dutta <amitdutta4255@gmail.com> 3 * Date : 08 Feb 2026 4 * Repo : https://github.com/notamitgamer/bsc 5 * License : MIT License (See the LICENSE file for details) 6 */ 7 8 /* Rewrite expressions using bitwise compound assignment operators. 9 */ 10 /* Let Us C, Chap- 21 (Operations on Bits), Qn No.: B(b) */ 11 12 /* This file is auto-generated by a bot. */ 13 /* This code is not compiled; it is for reference only. */ 14 15 16 #include <stdio.h> 17 #include <stdlib.h> 18 19 int main() 20 { 21 int a = 10, b = 20, c = 5; 22 23 printf("Original values: a=%d, b=%d, c=%d\n", a, b, c); 24 25 // a = a | 3 26 a |= 3; 27 printf("a |= 3 -> %d\n", a); 28 29 // a = a & 0x48 30 a &= 0x48; 31 printf("a &= 0x48 -> %d\n", a); 32 33 // b = b ^ 0x22 34 b ^= 0x22; 35 printf("b ^= 0x22 -> %d\n", b); 36 37 // c = c << 2 38 c <<= 2; 39 printf("c <<= 2 -> %d\n", c); 40 41 return 0; 42 }