PROBLEM 46
Medium

Two-Digit Number

Programming Basics · C++

</>
STATUS Not solved

TASK

Problem

#46

An integer `n` is given. Print `YES` if its absolute value is a two-digit number; otherwise print `NO`.

EXAMPLE

Example

Input
-12
Output
YES

LIMITS

Constraints

All values are integers with magnitude at most 10^9.
📖
LEARN Theory for this problem
+

Logical AND `&&`, OR `||`, and negation `!` combine boolean conditions. Parentheses make the intended grouping explicit.

Connection to “Two-Digit Number”: here, intermediate values are best kept in named variables so the formula stays readable and data types remain clear.

💡
NEED HELP? Hints
+

['Translate the verbal condition into one boolean expression.', 'After solving “Two-Digit Number”, verify the algorithm on your own small example and on an allowed boundary case. Print only the required result with no extra text.']

ANSWER Solution
+
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
    long long n;
    cin >> n;
    cout << ((10 <= llabs(n) && llabs(n) <= 99) ? "YES" : "NO") << '\n';
    return 0;
}