bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / letusc / luc104.c

luc104.c (693B)


      1 /* Rewrite expressions using bitwise compound assignment operators.
      2 */
      3 /* Let Us C, Chap- 21 (Operations on Bits), Qn No.: B(b) */
      4 
      5 /* This file is auto-generated by a bot. */
      6 /* This code is not compiled; it is for reference only. */
      7 
      8 
      9 #include <stdio.h>
     10 #include <stdlib.h>
     11 
     12 int main()
     13 {
     14     int a = 10, b = 20, c = 5;
     15 
     16     printf("Original values: a=%d, b=%d, c=%d\n", a, b, c);
     17 
     18     // a = a | 3
     19     a |= 3;
     20     printf("a |= 3        -> %d\n", a);
     21 
     22     // a = a & 0x48
     23     a &= 0x48;
     24     printf("a &= 0x48     -> %d\n", a);
     25 
     26     // b = b ^ 0x22
     27     b ^= 0x22;
     28     printf("b ^= 0x22     -> %d\n", b);
     29 
     30     // c = c << 2
     31     c <<= 2;
     32     printf("c <<= 2       -> %d\n", c);
     33 
     34     return 0;
     35 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror