Variables | Sololearn: Learn to code for FREE!



Please can someone explain increments to me very well.. For example Var a=0, b=10; Var a=b++ Output a=10, b=11 Please how does that give that?

9/12/2017 12:29:20 PM

Racheal Inyang Emmanuela

6 Answers

New Answer


What is answer


var a=0 var b=10 var a=b++// it shows that the value b++ is assign to a b++ is post increment so first value is assign then it will incremented so a=10 // because b++ value is still 10 due to post increment and now the value of b incremented by 1 so b=11 so finally the output is a=10 b=11


Var a = 0; Var b = 10; a = b++ at first a = b = 10 ++ means +1, so 10+1=11 a=11, b=10


first of all we have variables a =0 and b=10. and in second line we are assigning the value of b to a and use ++ ie increment operator so that at last we have output a=10, b =11


Answer is a=10, b=11


How do i programme input using console.log in java.