HTML Java script codes?

Bree

New member
I need help with this last javascript code I'm doing.

A javascript that will ask the user to input 2 integers and will display the sum, quotient, product, and difference.
 
Well, you didn't describe HOW the JavaScript 'ask' s the user for two inegers, so I'm going to assume a prompt box.
<script>
var num1 = prompt("Choose any number:","");
var num2 = prompt("Choose another number:","");
sum = (num1 + num2);
quotient = (num1 / num2);
product = (num1*num2);
difference = (num1 - num2);
document.write("Sum: " + sum + "\nQuotient: " + quotent + "\nProduct: " + product + "\nDifference: " + difference);
</script>
Good Luck!
If you need further assistance/advice, feel free to contact me.
 
Well, you didn't describe HOW the JavaScript 'ask' s the user for two inegers, so I'm going to assume a prompt box.
<script>
var num1 = prompt("Choose any number:","");
var num2 = prompt("Choose another number:","");
sum = (num1 + num2);
quotient = (num1 / num2);
product = (num1*num2);
difference = (num1 - num2);
document.write("Sum: " + sum + "\nQuotient: " + quotent + "\nProduct: " + product + "\nDifference: " + difference);
</script>
Good Luck!
If you need further assistance/advice, feel free to contact me.
 
Back
Top