27 lines
425 B
JavaScript
27 lines
425 B
JavaScript
const prompt = require("prompt-sync")({sigint: true});
|
|
|
|
function add(a, b) {
|
|
let e = a + b;
|
|
return e;
|
|
}
|
|
|
|
let c = prompt("Num 1: ");
|
|
let d = prompt("Num2: ");
|
|
let op = prompt("What operation? ");
|
|
|
|
if (op == "+") {
|
|
console.log(Number(c) + Number(d));
|
|
}
|
|
|
|
if (op == "-") {
|
|
console.log(Number(c) - Number(d));
|
|
}
|
|
|
|
if (op == "*") {
|
|
console.log(Number(c) * Number(d));
|
|
}
|
|
|
|
if (op == "/") {
|
|
console.log(Number(c) / Number(d));
|
|
}
|