Increment Operators

Lab C Intermediate 20 points

Read an integer x. Then run a = x++; and b = ++x; and print a, b and x.

Input

One integer.

Output

One line: a b x

Example

Input

5

Output

5 7 7
Sample input available Sample output available
Editor
C

Hints

x++ gives the old value, then adds 1.

++x adds 1 first, then gives the new value.

Solution explanation

Postfix returns the value before the change; prefix returns it after.

Show solution
#include <stdio.h>

int main() {
    int x, a, b;
    scanf("%d", &x);
    a = x++;
    b = ++x;
    printf("%d %d %d\n", a, b, x);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD