QUESTION IMAGE
Question
what is the output of this code fragment?
int a = 5 - 1;
int b = 2 * 3;
int c = a - b;
system.out.print(a + \ \ + b + \ \ + c);
Step1: Calculate value of a
$a = 5 - 1 = 4$
Step2: Calculate value of b
$b = 2 \times 3 = 6$
Step3: Calculate value of c
$c = a - b = 4 - 6 = -2$
Step4: Output a, b, c
Print $a + " " + b + " " + c$ → 4 6 -2
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
4 6 -2