Table of contents Home page
$x = 'Hello'; printf("The length of the previously printed string was %d bytes.\n", printf("%s world.\n", $x)); $x = 76; printf("The binary representation of %d is %b.\n", $x, $x); printf("The octal representation of %d is %o.\n", $x, $x); printf("The hexadecimal representation of %d is %x.\n", $x, $x); printf("The hexadecimal representation of %d is %X.\n", $x, $x); printf("%d in e-notation is %e.\n", $x, $x); printf("%d in E-notation is %E.\n", $x, $x); printf("The number %d corresponds to the ASCII character '%c'.\n", $x, $x); printf("The number %d left-padded with zeros to 4 digits is '%04d'.\n", $x, $x); $x = 7.6; printf("%f with 3 decimal places is %.3f\n", $x, $x); $x = -76; printf("The signed number %d corresponds to the unsigned number %u.\n", $x, $x);