Increment and decrement operators || Basic program || C programming

In this, we are going to write a program to use Increment and Decrement operator in C.

#include<stdio.h>

int main()
{
    int a=5;
    int b=10;
    int c=11;
    int d=12;

    //Post-Increment a++
    printf("Here first the value will be printed then incremented:  %d\n", a++);
    printf("This is the post incremented value of variable a : %d\n",a);

    //Pre-Increment ++b
    printf("This is pre-increment, here first the value of b will be incremented then printed:  %d\n", ++b);

    //Post-Decrement c--
    printf("Here first the value will be printed then decremented:  %d\n", c--);
    printf("This is the post decremented value of variable c : %d\n",c);

    //Pre-Increment --d
    printf("This is pre-decrement, here first the value of d will be decremented then printed:  %d\n", --d);

    return 0;
}
//....Coded by JAIDEEP JAMBLE
#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post