-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputVerifier.js
More file actions
33 lines (28 loc) · 821 Bytes
/
InputVerifier.js
File metadata and controls
33 lines (28 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function readLine() {
return inputString[currentLine++];
}
function makeInputVerifier(minimum, maximum) {
function verify(input)
{
if(input<minimum)
return ("Input is less than minimum value");
if(input>=minimum&&input<=maximum)
return ("Input is in range");
if(input>maximum)
return ("Input is more than maximum value");
else
return;
}
return verify;
//write your code here
}
function main() {
const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
const min = parseInt(readLine().trim());
const max = parseInt(readLine().trim());
const verify = makeInputVerifier(min, max);
const input = parseInt(readLine().trim());
const result = verify(input);
ws.write(`${result}\n`);
ws.end();
}