sandbox-js/calculator.js

19 lines
311 B
JavaScript
Raw Normal View History

2023-01-23 21:47:14 +01:00
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));
}
2023-01-23 21:48:49 +01:00
if (op == "-") {
console.log(Number(c) - Number(d));
}