Q:

Write a C# Sharp program to check two given integers whether either of them is in the range 100..200 inclusive

0

Write a C# Sharp program to check two given integers whether either of them is in the range 100..200 inclusive

Sample Output:

True
False
True

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;

namespace exercises
{
 class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(test(100, 199));
            Console.WriteLine(test(250, 300));
            Console.WriteLine(test(105, 190));
            Console.ReadLine();
        }
        public static bool test(int x, int y)
        {
            return (x >= 100 && x <= 200) || (y >= 100 && y <= 200);
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now