What is the output of the following code?
1 2 3 4 5 6 7 8 9 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
In
The suffix operator in
s++
is evaluated after the expression. So the above expression is equivalent toHence the answer is
( 8 ⋅ 6 ) % 7 = 6
Use prefix
++
(for eg++s
) to evaluate the increment in the expression itself.The
%
operator is the operator for modulo.