Al right, so here's what I'd do: You have an IP-address; 4 blocks, each of which consists of a number between 0 and 255. Instead of trying to handle them all together, split them up. For example, you could put them in an array. You could also assign a variable to each of the four numbers.
//Example
//IP is 192.168.189.23
// Array
[192 168 189 23]
//Variables
Number1 = 192
Number2 = 168
Number3 = 189
Number4 = 23
Use whatever you are most comfortable with using. I don't know how you're supposed to present this, but in the most basic form it'd look something like this (Syntax is not correct)
//IP address is 1.2.3.4
Var1 = 1 Bin1
Var2 = 2 Bin2
Var3 = 3 Bin3
Var4 = 4 Bin4
//convert Var1-4 into binary, maybe additional variables are neccessary to store the binary numbers
Print out ("You converted " Var1 "." Var2 "." Var3 "." Var4 "into" Bin1 "." Bin2 "." Bin3 "." Bin4)