Variable Operations

You can use all the standard types of variables operations in C#. When working with numbers, you can use various math symbols. C# follows the conventioal order of operations, performing exponentiation first,followed by multiplication and division and then addition and subtraction. You can also control order by grouping sub expression with parentheses.

int vNumber;
vNumber=4+2*3;
// vNumber will be 10.
vNumber=(4+2)*3;
//vNumber will be 18.

No comments:

Post a Comment