Computer Science, asked by BeastlyPhoenix, 7 months ago

int B[ ]={3,4,5,7,8,11,24,33,43,55};
int x= -1; System.out.println(B[++x]*B[x]);
System.out.println(++B[x++]);

Answers

Answered by sswaraj04
0

Answer:

Pre increment operator increases the value before operation while post increment completes the operation then increments the value

Here,

x = -1

B[++x] makes x = -1 +1 = 0

now B[0] * B[0] = 3 * 3 = 9

next line B[x++] would give result of B[0] only and then increment the value of x to 1

output will be ++3 = 4

so final output is

9

4

Explanation:

Hope it helps :-)

Similar questions