One integer n is given. Print “Ok” if n is
a two-digit number, and “No” otherwise.
Input. One integer n (|n| ≤ 109).
Output. Print “Ok” if n is a
two-digit number, and “No” otherwise.
Sample input 1 |
Sample output 1 |
17 |
Ok |
|
|
Sample input 2 |
Sample output 2 |
-123 |
No |
conditional
statement
The input
number can be negative. The number n is two-digit if
-99 ≤ n ≤ -10
or 10 ≤ n ≤ 99
Algorithm
implementation
Read the input value of n.
scanf("%d", &n);
Print the answer.
if ((n > -100 && n <
-9) || (n > 9 && n < 100)) puts("Ok");
else puts("No");
Python implementation
Read the input value of n.
n = int(input())
Print the answer.
if (-100
< n < -9) or
(9 < n < 100): print("Ok")
else: print("No")