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

Popular posts from this blog

Check whether the no entered is Palindrome or not

Calculate Factorial of a given no with help of Recursion

Find max. and min. element in the integer array