[Solved] How to check in C# whether a particular number is bigger than another number?

  

2
Topic starter

How to check in C# whether a particular number is bigger than another number?

For example whether 1 is bigger than 2.

1 Answer
2

Use the Boolean data type


The Boolean data type is a data type, having two values (usually denoted true and false), intended to represent the truth values of logic and Boolean algebra.

It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century.


In C# the code will look like this:

using System;
 
class CheckWhosBigger
{
    static void Main()
    {
        int a = 1;
        int b = 2;
        bool Check = (a > b); // False
        Console.WriteLine(Check);
    }
}
Share: