# Simple calculator

Implement a simple calculator of your own in your website , use thoe following code inside your " body " tag , here functions for addition , subtraction , multiplication and division are written seperatly and is called when the appropriate button is pressed .

``<form><table border=2 cellpadding=3 bgcolor=#E6E9EA><tr><td><div align="center"><b>Enter 2 Numbers:</b><br><input type=text size=5 name=num1><input type=text size=5 name=num2></div></tr></td><tr><td><div align="center"><b>Click on a Function</b><br><input type=button name=a1  value="  + " onclick="addFields(this.form)"><input type=button name=a2  value="  -  " onclick="subFields(this.form)"><input type=button name=a3  value="  x " onclick="mulFields(this.form)"><input type=button name=a4  value="  /  " onclick="divFields(this.form)"></div></td></tr><tr><td><div align="center"><B>The Answer is:</B><br><input type="text" size=8 name="result"></div></td></tr><tr><td><div align="center"><input type=reset name=clear  value="clear fields"></div></td></tr></table></form></td></table><script language="javascript">function   addFields(form) {	 var sum = eval(form.num1.value) + eval(form.num2.value)	form.result.value=sum	}function   subFields(form) {	 var sub = eval(form.num1.value) - eval(form.num2.value)	form.result.value=sub	}function   mulFields(form){	 var mul = eval(form.num1.value) * eval(form.num2.value)	form.result.value=mul	}function   divFields(form) {	form.result.value  = eval(form.num1.value) / eval(form.num2.value)}</script>``