bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / letusc / luc103.c

luc103.c (848B)


      1 /* What is the hexadecimal equivalent of the following binary numbers?
      2 */
      3 /* Let Us C, Chap- 21 (Operations on Bits), Qn No.: B(a) */
      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     // Binary numbers represented as string literals for reference
     15     // 01011010
     16     // 11000011
     17     // 1010101001110101
     18     // 111100001011010
     19 
     20     printf("Binary: 01011010          -> Hex: 0x%X\n", 0b01011010);
     21     printf("Binary: 11000011          -> Hex: 0x%X\n", 0b11000011);
     22     printf("Binary: 1010101001110101  -> Hex: 0x%X\n", 0b1010101001110101);
     23     printf("Binary: 111100001011010   -> Hex: 0x%X\n", 0b111100001011010);
     24 
     25     /* Note: Binary literals (0b...) are a standard C extension (GCC) and part of C23 standard. */
     26     
     27     return 0;
     28 }