DEV Community

Ivan Ivanov
Ivan Ivanov

Posted on

10. Invalid Number (Using Bool)

using System;

namespace InvalidNumber
{
class Program
{
    static void Main(string[] args)
    {
        int num = int.Parse(Console.ReadLine());

        bool isValid = (num >= 100 && num <= 200) || num == 0;

        if (!isValid)
        {
            Console.WriteLine("invalid");
        }
    }
}
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)