PROBLEM 33
Easy

Divisible by 5

Programming Basics · JavaScript

</>
STATUS Not solved

TASK

Problem

#33

Print `YES` if `n` is divisible by 5, otherwise `NO`.

EXAMPLE

Example

Input
42
Output
NO

LIMITS

Constraints

All numeric input values fit in JavaScript `Number`.
📖
LEARN Theory for this problem
+

### Divisible by 5

`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.', 'Check values exactly on the condition boundary: `=`, `<`, and `>` must match the statement without an off-by-one shift.']

ANSWER Solution
+
const fs = require('fs');

const n = Number(fs.readFileSync(0, 'utf8').trim());
const divisible = n % 5 === 0;

console.log(divisible ? 'YES' : 'NO');