본문 바로가기

Study Meeting/빡공단 30기

[Day 7] Quadratic expression for C Programming

In this class, I learned about quadratic expression for specific values.
Computers utilize binary, octal, and hexadecimal numbers, and their purpose of use varies depending on the pros and cons of the expression method.

1) Binary expression: 0 or 1
2) Octal expression: 0 ~ 7
3) Hexadecimal expression
     - 0 ~ 9 and A ~ F are used
     - Using %X for printing the value with printf() function

And here's a example code for converting from decimal to binary, octal and hexadecimal expression. 

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    
    printf("%d \n", 123);
    
    printF("%d \n", 0b01111011);   // '0b' means binary expression
    
    printf("%o", 123);
    
    printf("%x", 123);
    
    return 0;
}