Saturday, January 4, 2014

Increment and Decrement in C#

There are two operators use for increasing or decreasing the values of a variable by 1.
The increment operator is denote by "++" and the decrement operator is denoted by "--".

Example

int num;
num =10;
num++;

After the last statement, the value of 'num' is 11.Similarly,

int num;
num=10;
num--;

The last statement will decrease the value of  'num' by 1 and make it 9.

No comments:

Post a Comment