LoginSignup
0

More than 5 years have passed since last update.

【C】10進数と16進数を表示する小さなサンプル

Last updated at Posted at 2017-06-10
test.c
#include <stdio.h>

int main(void){
        int d = 100;      // decimal
        int x = 0x100;    // hexadecimal

        printf("d = %d\n", d);
        printf("x = %d\n", x);

        printf("d = 0x%x\n", d);
        printf("x = 0x%x\n", x);

        return 0;
}
実行結果
d = 100
x = 256
d = 0x64
x = 0x100

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0