Explore BrainMass

Explore BrainMass

    binary, octal, and hexadecimal equivalents

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I'm have trouble writing two programs that each print a table of the binary, octal, and hexadecimal equivalents of the decimal numbers in the range 1-256. The problem is that i have to use the computer lanuage C # which is relatively new please help.

    © BrainMass Inc. brainmass.com December 24, 2021, 5:17 pm ad1c9bdddf

    Solution Preview

    Try the following program in C code. The program and executable is also attached.

    #include <string.h>

    void dec2bin(int decimal, char *binary);
    char *conv_dec(int number, int base);

    void main()


    int i;
    char binary[80];

    printf("Decimal t Binary t Hexadecimal t Octal n");

    printf("t t %s",binary);
    printf("t %s",conv_dec(i, 16));
    printf("t t %s",conv_dec(i, 8));
    printf("t t ...

    Solution Summary

    This job examines binary, octal, and hexadecimal equivalents.