Check your browser console, and you would see that it would display a message "Unexpected string".
document.write("r=20cm<br>" "'π'=3.14<br>" "P=r<sup>2</sup>'π'<br>" "P=" + (P) + "cm<sup>2</sup>");
Was the problem. You can only supply one string to be written. You would have to make those multiple strings a single one by adding +
in between.
document.write("r=20cm<br>" + "'π'=3.14<br>" + "P=r<sup>2</sup>'π'<br>" + "P=" + (P) + "cm<sup>2</sup>");
should work.