#include <stdio.h>

/* Terry Harvey CISC105 Section 21 TA Aaron*/
/* Program to convert 19 base 10 to base 2 (binary) */

/* 
 * Find the highest power of 2 that is <= than decimal 
 * Store it in powerOf2
 *
 * if powerOf2 <= decimal, print 1; 
 *                    Subtract powerOf2 from decimal, store in variable difference
 * else print 0
 * 
 * store difference in decimal  /* is this a waste of time?
 * powerOf2 = powerOf2 / 2;
 *
 * CHANGES
 * take user input
 * find initial powerOf2
 */


int main(){

    int decimal = 31;
    int difference;
    int powerOf2 = 16;

    while (powerOf2 > 0){
	if (powerOf2 <= decimal){
	    printf("1");
	    difference = decimal - powerOf2;
	}
	else
	    printf("0");

	decimal = difference;
	powerOf2 = powerOf2 / 2;
    }
    printf("\n");
    return 0;
}
