If Statement in C#

aaaaaaaaaaaaaaaaa

Operators in C#

Operators Associativity Type
( ) left to right Parentheses
! Logical NOT
*   /   % left to right Arithmetic and modulus
+   - left to right Arithmetic
<   >   <=   >= left to right Relational
==   != left to right Relational
&& Logical AND
|| Logical OR
= right to left Assignment

Expressions in C#

Operator Expression Is true if
== x == y x is equal to y
!= x != y x is not equal to y
> x > y x is greater than y
< x < y x is less than y
>= x >= y x is greater than or equal to y
<= x <= y x is less than or equal to y

General form of If Statement


if(this condition is true)
    execute this statement;

If and Else Statement
Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            Console.Write("Enter first number: ");
            a = Int32.Parse(Console.ReadLine());
            Console.Write("Enter second number: ");
            b = Int32.Parse(Console.ReadLine());
            if (a == b) //it checking if 'a' greater then 'b'
                Console.Write("First and Second is Equal to"); //then print this line.
            else //if not means less then or greater then to
                Console.Write("First and Second is Not Equal to"); //then print this line.
            Console.ReadKey(); //used for breaking screen.
        }
    }
}
Output
Hello
World!

Only If Statements
Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            Console.Write("Enter first number: ");
            a=Int32.Parse(Console.ReadLine());
            Console.Write("Enter second number: ");
            b = Int32.Parse(Console.ReadLine());
            if (a > b) //it checking if 'a' greater then 'b'
                Console.Write("First is greater then Second."); //then print this line.
            if (a < b) //it checking if 'a' is less then 'b'
                Console.Write("First is less then Second."); //then print this line.
            if (a == b) //it checking if 'a' equal to 'b'
                Console.Write("First is equal to Second."); //then print this line.
            Console.ReadKey();
        }
    }
}
Output
Hello
World!