BACK

JavaScript program to calculate multiplication and division of two numbers (input from user).




The Result Is:




CODE:

function evMultiply() {
var ekran = document.querySelector("#ekran");
var num1 = document.querySelector("input[name=num1]").value;
var num2 = document.querySelector("input[name=num2]").value;
var rezult = 1 * num1 * 1 * num2;
ekran.innerHTML = num1 + " x " + num2 + " = " + rezult;
}

function evDivide() {
var ekran = document.querySelector("#ekran");
var num1 = document.querySelector("input[name=num1]").value;
var num2 = document.querySelector("input[name=num2]").value;
var rezult = ((1 * num1) / (1 * num2)).toFixed(2);
ekran.innerHTML = num1 + " : " + num2 + " = " + rezult;
}