-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
22 lines (20 loc) · 705 Bytes
/
index.ts
File metadata and controls
22 lines (20 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var prompt = require("prompt-sync")()
let n1 = parseInt(prompt('Please enter your first number:'))
let n2 = parseInt(prompt('Please enter your second number:'))
let operator = prompt('Please enter your operator (+, -, *, /):')
if(operator == '+'){
console.log(`the anser of${n1} ${operator} ${n2} = ${n1+n2}`);
}
else if(operator == '-'){
console.log(`the anser of${n1} ${operator} ${n2} = ${n1-n2}`);
}
else if(operator == '*'){
console.log(`the anser of${n1} ${operator} ${n2} = ${n1*n2}`);
}
else if(operator == '/'){
console.log(`the anser of${n1} ${operator} ${n2} = ${n1/n2}`);
}
else{
console.log('please select the correct operators');
}
export {};