How to check if the number is positive or negative in C# ?

You can use the > and < operator to check if the number is a positive or negative number in C#.

How to check if the number is positive or negative in C# ?

If the number is less than zero , it can be considered as negative number. If the number is greater than zero , it is a positive number. Below is a sample code that finds out if the number is a positive or negative number.

using System;
namespace ACCode
{
    class Program
    {
        static void Main(string[] args)
        {
            int input1 = 85;
            bool positiveNumber = input1 > 0;
            bool negativeNumber = input1 < 0;
            Console.WriteLine(positiveNumber);
            Console.WriteLine(negativeNumber);
            Console.ReadLine();
        }
      
    } 
}