Operators in expression, C# programming

March 02, 2014 0 Comments

There are various types of operators, we use in expression. Where we use multiple arithmetic operator known as expression. Your arithmetic expression is
In this expression, we used three operator, such as assignment operator, arithmetic positive, and  arithmetic multiplication operator. Also we used four operands, such as a,b,c and d operands. So we use variety of operator for designing expression for user query. Some of operator we use, like
Mathematical operators are
+, -  :  Unary positive, negative
+ : Addition
- : Subtraction
* : Multiplication
/ : Division
% : reminder

If you use more than one operator in any expression, evaluate expression according to operator precedence also evaluate expression left to right according to precedence rule.
Now, just take an simple precedence of mathematical operator are:

Unary + and - (I)

* and /  (II)

+ and - (III)

In above mentioned expression ( d=a+b*c ), first calculate multiplication between operand b and c, after that result of the multiplication will be added with operand a. If you want to override the default precedence, use parentheses around the portion of the expression that is to be evaluated first. In some other expression, where we use string datatype then we use + operator for string concatenation. So we can say that '+' operator is used in addition as well as string concatenation.

Jacob Lefore

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google