Create an array with each binary value. int binary_value=(128,64,32,16,8,4,2,1); Also a null string variable, to hold '0' and '1's. ie:string Bin_num=""; This will let you convert numbers up to 255. To go higher, increase the the array to 16, and add more values, doubling as you go, as in the above. The ask for an integer number, and do a for loop. Check if the number is greater than the first number in your array. If yes, have the string variable to equal itself plus a "1", and subtract the value of binary_value[x] from the inputted decimal value. If not, a "0" is added to the string variable, instead. Of course, you'll have to set the limits on the inputted value. 255 with the above, or 65535, if you double the array size. Then print out the string variable, when the loop ends.