C Program to convert a value into different formats using format specifiers

An integer value 100 stored in a variable a is printed with different format specifiers.

  1. %d prints integer
  2. %x prints hex
  3. %o prints octal
  4. %u prints unsigned integer


void main()
	int a = 100;
	printf("Integer: %d\n", a);
	printf("Hex: %x\n", a);
	printf("Octal: %o\n", a);
	printf("Unsigned Decimal: %u\n", a);


Decimal: 100
Hex: 64
Octal: 144
Unsigned Decimal: 100