Program To Show Increment And Decrement Operators In C Programming Language

Increment And Decrement In C Language


    /* increment and decrement operator */
    
 #include<stdio.h>
 #include<conio.h>
 
    void main()

  {
    /*i++// post increment

    ++i // pre increment

    i-- //post decrement
    --i // pre decremnet
      */


      int i=5,a=0;

      clrscr();
     printf("pre Increment of i %d ", ++i); //i=6
     printf("\n post increment of i= %d", i++);

	 printf("pre decrement of i= %d\n", --i);
	 printf("post decrement of i= %d\n", i--);
	  printf(" update value of i =%d",i);

	  a=++i;
	 printf("the value of a is %d",a);
	     a=i++;
	     printf("The value of a is %d \n ",a);// a=5
	     printf("The value of a is %d\n",a); //a=5
	     getch();

  }      //                            i=++i;
    

Output

increment-and-decrement 




Facebook Likes

Youtube