Arithmetic operators

C# defines the following arithmetic operators.

OperatorMeaning
+Addition
-Subtraction
*Multiplication
/Division
%Remainder

The following code illustrates how to use the basic arithmetic operators.


using System;

class Program
{
    static void Main(string[] args)
    {
        int i = 4;
        int j = 5;

        int result = i + j;

        Console.WriteLine(result);
    }
}

The result


9
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.