Write 3 JavaScript programs:
The first should compute the sum of 2 given integers. The second should multiply the 2 integers. The third should triple the sum of the 2 integers.
function sum(a,b){ return a+b; } i = parseInt(prompt("Enter first number: ")) j = parseInt(prompt("Enter second number: ")) console.log("Sum = "+sum(i,j));
function mult(a,b){ return a*b; } i = parseInt(prompt("Enter first number: ")) j = parseInt(prompt("Enter second number: ")) console.log("Product = "+mult(i,j));
function tripleSum(a,b){ return 3*(a+b); } i = parseInt(prompt("Enter first number: ")) j = parseInt(prompt("Enter second number: ")) console.log("Sum = "+tripleSum(i,j));
Get Answers For Free
Most questions answered within 1 hours.