Using Increment/Decrement Operators
#include<stdio.h>
#include<conio.h>
int main()
{
int x = 10,y = 20;
printf("----INCREMENT OPERATOR EXAMPLE---- \n");
printf("Value of x : %d \n", x); //Original Value
printf("Value of x : %d \n", x++); // Using increment Operator
printf("Value of x : %d \n", x); //Incremented value
printf("----DECREMENT OPERATOR EXAMPLE---- \n");
printf("Value of y : %d \n", y); //Original Value
printf("Value of y : %d \n", y--); // using decrement Operator
printf("Value of y : %d \n", y); //decremented value
return 0;
}
Output:-
----INCREMENT OPERATOR EXAMPLE----
Value of x : 10
Value of x : 10
Value of x : 11
----DECREMENT OPERATOR EXAMPLE----
Value of y : 20
Value of y : 20
Value of y : 19
Comments
Post a Comment