C Basic 63: Math with Increment Decrement

6 January 2020, 1:20 am by antelove19

C programming language

C programming language



Happy Coding


main.c

/* ------------------------------------------------------------ */
/*  Math                                                        */
/*  Using Arithmetic Operators increment and decrement          */
/*                                                              */
/*  Author: antelove                                            */
/*  Website: antelove.com                                       */
/* ------------------------------------------------------------ */

#include <stdio.h> // standar input output library

int main() {

    int x = 10;

    // increment
    printf("x     = %d \n", x);
    printf("x + 1 = %d \n", x + 1);

    x++;
    printf("x++   = %d \n", x);


    printf("-----------------\n");


    int y = 20;

    // decrement
    printf("y     = %d \n", y);
    printf("y - 1 = %d \n", y - 1);

    y--;
    printf("y--   = %d \n", y);

    getchar();

    return 0;    

}

Thank for reading :)



No Action Title
1 Live
2 Editor
0 comment