Or you can also (without if-else statement):
1. Declare two variables (n and result).
2. Read the user input from the console. (int.Parse(Console.ReadLine());).
3. Check if the input number is greater than 20 and odd by using the logical operators:
a. > or < checks if the value on the left of the operator is greater/less than the value on the right side of the operator;
b. Using the formula n % 2 != 0 you check whether the entered number is odd.
c. && checks if the left expression AND the right expression both have true values;
d. Save the result of the verification in the result variable;
4. Print the result on the console (Console.WriteLine(result));)
You can use this code instead of the above one:
using System;
class CheckNumber
{
static void Main()
{
Console.WriteLine("Write your number:");
int n = int.Parse(Console.ReadLine());
bool result = (n > 20) && (n % 2 != 0);
Console.WriteLine(result); //true or false
}
}