Mask an IP address and give its broadcast
JavaScript (ES6), 92 bytes

(a,m)=&gt;a.split`.`.map((n,i)=&gt;(v=m[i],m[i]=n&amp;v|v^255,n&amp;v),m=m.split`.`).join`.`+" "+m.join`.`


Explanation

(a,m)=&gt;
  a.split`.`
  .map((n,i)=&gt;(
      v=m[i],
      m[i]=n&amp;v|v^255,
      n&amp;v
    ),
    m=m.split`.`
  ).join`.`
  +" "+m.join`.`


Test



var solution = (a,m)=&gt;a.split`.`.map((n,i)=&gt;(v=m[i],m[i]=n&amp;v|v^255,n&amp;v),m=m.split`.`).join`.`+" "+m.join`.`
&lt;input type="text" id="input" value="10.25.30.40 255.252.0.0" /&gt;
&lt;button onclick="result.textContent=solution.apply(null,input.value.split` `)"&gt;Go&lt;/button&gt;
&lt;pre id="result"&gt;&lt;/pre&gt;