Write an algorithm that takes two numbers and calculates the

product of the numbers using the binary operator '+' only i.e. the

algorithm should NOT use the binary operator 'x'.

multiplication is akin to repeated addition. For example if there are 5 groups of 3 items then. 3 + 3 + 3 + 3 + 3 = 15

HTH

I found the error sorry for the late post but i will still share the solution in case someone may need to see it to help them with something Dont worry i found the error solution is below

<html>

<head>

<title>

Calculator

</title>

<script type="text/javaScript">

<!-- Begin

function doMath() {

var one = eval(document.theForm.elements[0].value);

var two = eval(document.theForm.elements[1].value);

var prod=0;for (var i=0; i<two; i++)

{

prod = prod + one;

}

alert("The product of " + one + " and " +

two + " is " + prod + ".")

}

// End -->

</script></head>

<body>

<CENTER>

<FORM NAME="theForm">

Multiply

<INPUT TYPE="text">

By

<INPUT TYPE="text">

<INPUT TYPE="button" VALUE="Show result" onClick="doMath()">

</FORM>

</CENTER></body>

</html>

Ask Your Question

Weekly Poll

Would you ride in a self-driving car from Tesla?

Discuss in The Lounge

Poll History