to clarify my wonder, I have no clue how subnet is calculated.

I thought it had some logic but according to logic with input like:
Input: IP=192.10.128.55, Subnet=27

the output should be array...
_________________________
!

download KiXnet