Purchase Solution

binary, octal, and hexadecimal equivalents

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Solution Summary

This job examines binary, octal, and hexadecimal equivalents.

Solution Preview

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

#include<stdio.h>
#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");

for(i=1;i<=256;i++)
{
printf("%ld",i);
dec2bin(i,binary);
printf("t t %s",binary);
if(i>31)
{
printf("t %s",conv_dec(i, 16));
printf("t t %s",conv_dec(i, 8));
}
else
{
printf("t t ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.