#include <iostream>
using namespace std;

void main (void)
{
	int den, bin, binOut[8], i, pos=0;
	for (i=0; i<8; i++)
	{
		binOut[i] = 0;
	}
	cout << "this program will convert nubers to binary up to a maximum of 255 \n";
	do
	{
		cout << "Enter number to be converted : ";
		cin >> den;
		if (den > 255) cout <<"numbers must be less than 256 !!\n";
		if (den < 0) cout << "numbers must not be negative !!\n";
	}
	while ((den > 255) || (den <0));
	while (den > 0)
	{
		bin = den%2;
		//cout << bin << " ";
		binOut[pos] = bin;
		pos++;
		den = den/2;
	}
	for(i=pos-1; i>=0; i--)
		cout << binOut[i];
	cout << endl;
}
