With out all the game code this is what it looks like.
#include <stdio.h>
#include <math.h>
int BinaryNum[50];
long ExpLoop;
long PlaceHolder;
long UserNumber;
int main()
{
printf("Give me a Number to Convert to Binary. Up to 65536_\n");
scanf("%i", &UserNumber);
for (ExpLoop = 15; ExpLoop > 0; ExpLoop--)
BinaryNum[ExpLoop] = 0;
for (ExpLoop = 15; ExpLoop >= 0; ExpLoop--)
{
PlaceHolder = pow(2, ExpLoop);
if (UserNumber >= PlaceHolder)
{
UserNumber -= PlaceHolder;
BinaryNum[ExpLoop] = 1;
}
}
for (ExpLoop = 15; ExpLoop >= 0; ExpLoop--)
printf("%i", BinaryNum[ExpLoop]);
for (ExpLoop = 0; ExpLoop <= 15; ExpLoop++)
{
if (BinaryNum[ExpLoop] == 1)
UserNumber += pow(2, ExpLoop);
}
printf("\n The Number You used was %i", UserNumber);
getch();
return 0;
}