QUESTION IMAGE
Question
int a = 19 - 17; int b = a * 5; int c = a % b; what is the output of the following code fragment? system.out.println(a + \ \ + b + \ \ + c); 2 10 2 2 10 5 2 10 0
Step1: Calculate value of a
$a = 19 - 17=2$
Step2: Calculate value of b
$b=a*5 = 2*5 = 10$
Step3: Calculate value of c
The % operator is the modulus operator, which gives the remainder of the division. So $c=a\%b=2\%10 = 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
2 10 2