0% found this document useful (0 votes)
4 views2 pages

Simple Online Calculator Tool

This document is an HTML code for a simple calculator that performs addition, subtraction, multiplication, and division. It uses JavaScript functions to handle the calculations and alerts the results to the user. The calculator includes input fields for two numbers and buttons to execute the operations.

Uploaded by

ahsanhasnain2834
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Simple Online Calculator Tool

This document is an HTML code for a simple calculator that performs addition, subtraction, multiplication, and division. It uses JavaScript functions to handle the calculations and alerts the results to the user. The calculator includes input fields for two numbers and buttons to execute the operations.

Uploaded by

ahsanhasnain2834
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

<html>

<head><title>Simple calculator</title></head>

<script language="JavaScript">

function add()

{var a=[Link]; var b=[Link];

alert(parseFloat(a)+parseFloat(b));}

function subt()

{var a=[Link]; var b=[Link];

alert(parseFloat(a)-parseFloat(b));}

function mult()

{var a=[Link]; var b=[Link];

alert(parseFloat(a)*parseFloat(b));}

function div()

{var a=[Link]; var b=[Link];

if(parseFloat(b)==0){alert("divide zero error");}

else{alert(parseFloat(a)/parseFloat(b));}}

</script>

<body>

<H1>My Calculator</H1>

<form name="calculate">
<br>

<p>First number:<input type="text" name="value1" maxlength="3">

<br><br>

Second Number:<input type="text" name="value2">

<br><br><br><input type="button" value="Addition" onclick="add()">

<input type="button" value="Subtraction" onclick="subt()">

<input type="button" value="Multiply" onclick="mult()">

<input type="button" value="Divide" onclick="div()">

<input type="reset" value="Reset">

</form>

</body>

</html>

You might also like