int value

how to printf exactly 0605? help pls..

value =0605;
printf("%d",value);
 
    printf("%04d", value);


Maikel
ok thanks maikel, i did it with print("%02d",value);
Make sure you are aware that in C numbers with a leading zero are octal, so int value = 0605; assigns the value 389 to the variable 'value'.

If you wish to printf the number in octal, you need to use the octal format specifier: printf("%04o", value);

Hope this helps.
Topic archived. No new replies allowed.