English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

12. Write a program that print a table of the binary(out of four digit) octal and hexadecimal equivalents of the decimal number in the rang 1 to 15.

2007-03-17 08:48:01 · 1 answers · asked by ? 1 in Computers & Internet Programming & Design

1 answers

Is that a question or a demand. :)

You don't state which language.

#include
int main()
{
int x;

for (x=1; x<=15; x++)
printf("%d: Oct=[%o]\tHex=[%x]\n",x,x,x,x);
}

Oh, and to print binary value, you'll need to write a little routine for that. (Come on - you gotta do some of your own homework.)

2007-03-17 08:56:59 · answer #1 · answered by BigRez 6 · 0 0

fedest.com, questions and answers