30 days of code: Day 3

https://www.hackerrank.com/domains/tutorials/30-days-of-code

No key notes to add for Day 3.

int N = Convert.ToInt32(Console.ReadLine().Trim());

bool _isOdd;

_isOdd = N % 2 != 0;

if (_isOdd)
{
    Console.WriteLine("Weird");
}

if (!_isOdd && N is >= 2 and <= 5)
{
    Console.WriteLine("Not Weird");
}

if (!_isOdd && N is >= 6 and <= 20)
{
    Console.WriteLine("Weird");
}

if (!_isOdd && N > 20)
{
    Console.WriteLine("Not Weird");
}

Leave a Reply

Your email address will not be published. Required fields are marked *