Q:

Write a C# Sharp program to check if one given temperatures is less than 0 and the other is greater than 100

1

Write a C# Sharp program to check if one given temperatures is less than 0 and the other is greater than 100

Sample Output:

True
True
False

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(120, -1));
            Console.WriteLine(test(-1, 120));
            Console.WriteLine(test(2, 120));
            Console.ReadLine();
        }

        public static bool test(int temp1, int temp2)
        {
            return temp1 < 0 && temp2 > 100 || temp2 < 0 && temp1 > 100;
        }
    }
}

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