PROBLEM 74
Medium

Loan Conditions

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#74

Given `age`, monthly `income`, and current `debt`. Loan is approved if 18≤age≤65, income≥50000, and debt=0.

EXAMPLE

Example

Input
30 70000 0
Output
APPROVED

LIMITS

Constraints

0 ≤ age ≤ 120; income ≥ 0; debt ≥ 0
📖
LEARN Theory for this problem
+

### Loan Conditions

`if / else if / else` chooses a branch from boolean conditions. Comparisons such as `<`, `>=`, `===` and logical operators `&&`, `||`, `!` combine the exact rules that decide which output is valid.

💡
NEED HELP? Hints
+

['Translate every case from the statement into a boolean condition before writing branches.', 'Mentally substitute at least one value for each branch and verify that exactly the intended branch runs.']

ANSWER Solution
+
const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trimEnd();
let [a, i, d] = input.trim().split(/\s+/).filter(Boolean).map(Number);
if (((18 <= a) && (a <= 65)) && (i >= 50000) && ((d) === (0))) {
    console.log("APPROVED");
} else {
    console.log("DENIED");
}