C Tutorial/printf scanf/scanf octal
Reading hexadecimal and octal values
#include <stdio.h>
int main(void)
{
int i = 0;
int j = 0;
int k = 0;
int n = 0;
printf("Input:\n");
n = scanf(" %d %x %o", &i , &j, &k );
printf("\nOutput:\n");
printf("%d values read.", n);
printf("\ni = %d j = %d k = %d\n", i, j, k );
return 0;
}
Input: 3 2 3 Output: 3 values read. i = 3 j = 2 k = 3