Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Increment and Decrement Operators

// Working of increment and decrement operators

#include <iostream>
using namespace std;

int main() {
    int a = 10, b = 100, result_a, result_b;

    // incrementing a by 1 and storing the result in result_a
    result_a = ++a;
    cout << "result_a = " << result_a << endl;


    // decrementing b by 1 and storing the result in result_b   
    result_b = --b;
    cout << "result_b = " << result_b << endl;

    return 0;
}
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #Increment #Decrement #Operators
ADD COMMENT
Topic
Name
4+6 =