|
Description
This shows how to display
integers formatted as octal or hexadecimal
.
Code
/*displays octal
, hexadecimal numbers*/
#include <stdio.h>
int main()
{
int i;
for(i=1;i<=16;i++)
{
printf("%o ",i); /*octal
representation*/
printf("%x ",i); /*hexadecimal
representation*/
printf("%X ",i); /*uppercase
hexadecimal*/
printf("\n");
}
return 0;
}
Information
tested with Visual C++
6 , LCC Win 32
|