Calculator Program

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

<html> <title>Calculator</title> <body bgcolor ="black" text ="white"> <h1><b><i><center> Calculator<center></i></b></h1> <h3><center>You Can perform few Mathematical Operations

here.<br>Enter the Value of 'a' and 'b' in the given TEXT FIELDS.<br> Click '+' for addition.<br> Click '-' for Subtraction.<br> click '*' for multiplication.<br> click '/' for division.<br> Check out the result in Third TEXT FIELD.<br> Enjoy the new Html Calculator<br><center></h3> </body> <form name <h3>Enter <h3>Enter <h3>Answer </form> ="f1"> a= <input type ="text" name="t1" value =""></h3><br> b= <input type ="text" name="t2" value =""></h3><br><br> c= <input type ="text" name="t3" value =""></h3><br><br>

<script type ="text/javascript"> function add() { var a,b,c; a=parseInt(document.f1.t1.value); b=parseInt(document.f1.t2.value); c=a+b; document.f1.t3.value=c; }

function sub() { var a,b,c; a=parseInt(document.f1.t1.value); b=parseInt(document.f1.t2.value); c=a-b; document.f1.t3.value=c; }

function mul() { var a,b,c; a=parseInt(document.f1.t1.value); b=parseInt(document.f1.t2.value); c=a*b; document.f1.t3.value=c; }

function div() { var a,b,c; a=parseFloat(document.f1.t1.value); b=parseFloat(document.f1.t2.value); c=a/b; document.f1.t3.value=c; } </script> &nbsp&nbsp<input &nbsp&nbsp<input &nbsp&nbsp<input &nbsp&nbsp<input type type type type ="button" ="button" ="button" ="button" name name name name ="b1" ="b2" ="b3" ="b4" value value value value ="+" ="_" ="*" ="/" onclick onclick onclick onclick ="add()"> ="sub()"><br><br> ="mul()"> ="div()">

</html>

You might also like