Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

int a = -8 + 15; int b = a + 3; int c = a + b; system.out.println(a + \…

Question

int a = -8 + 15; int b = a + 3; int c = a + b; system.out.println(a + \ \ + b + \ \ + c); what is the output of the following code fragment? -6 -3 -9 -7 -4 -11 7 10 17

Explanation:

Step1: Calculate value of a

$a=-8 + 15=7$

Step2: Calculate value of b

Since $a = 7$, then $b=a + 3=7+3 = 10$

Step3: Calculate value of c

Since $a = 7$ and $b = 10$, then $c=a + b=7+10 = 17$

Answer:

C. 7 10 17