There are various types of operators, we use in expression. Where we use multiple arithmetic operator known as expression. Your arithmetic expression is

d=a+b*c;

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

- : 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.

d=a+b*c;

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.

## 0 comments:

## Post a Comment