Reading Hexadecimal and Octal Values - C Language Basics

C examples for Language Basics:scanf

Description

Reading Hexadecimal and Octal Values

Demo Code

#include <stdio.h>

int main(void)
{
  int i = 0;/*from   ww  w .j  a v  a  2  s .c om*/
  int j = 0;
  int k = 0;
  int n = 0;

  printf("Enter three integer values:");
  n = scanf(" %d %x %o", &i , &j, &k );

  printf("\nOutput:\n");
  printf("%d values read.\n", n);
  printf("i = %d   j = %d   k = %d\n", i, j, k );
  return 0;
}

Result


Related Tutorials