Computer Science, asked by hasanansari2392, 6 months ago

What will be the output of the following code:
var a, b
a = 8
b = 10
b += a
att
b+=a

document.write ("a = " + a + "<br>")
document.write ("b = " + b)​

Answers

Answered by rameshchandrasoni149
0

Answer:

Increment and decrement operators are unary operators that add or subtract one, to or from their operand, sequentially. They are commonly implemented in imperative programming languages like java, c, c++ the increment operator increments the value of the variable by one, and similarly, the decrement operator decrements the value of the variable by one.

a=6

a++ // a becomes 7

++a // a becomes 8

a-- // a becomes 7

--a // a becomes 6

Increment operators:

the increment operator increments the value of the variable in the expression. If the increment operator(++) is used as a prefix (before the variable), then the value of the variable is increased, and then it returns the value. If the increment operator is used as postfix(after the variable), then the original value is returned, and then the variable is increased by one.

Example in C programming:

#include <stdio.h>

int main() {

int a = 6, b = 6;

// a is displayed

// Then, a is increased to 7.

printf("%d post-increment n", a++);

// b is increased to 7

// Then, it is displayed.

printf("%d pre-incrementn", ++b);

return 0;

}

Similar questions