QUESTION IMAGE
Question
int a = 18;
int b = 3;
int c = 12;
if (a - b < c)
system.out.println(\totally\);
if (a + -2 * b <= c)
system.out.println(\awesome\);
what is the output of the program?
totally awesome
awesome
totally
Step1: Calculate \(a - b\)
Given \(a = 18\) and \(b = 3\), then \(a - b=18 - 3=15\).
Compare \(15\) with \(c = 12\). Since \(15>12\), the first if - condition \((a - b < c)\) is false.
Step2: Calculate \(a+(- 2*b)\)
First, calculate \(-2*b\): \(-2\times3=-6\).
Then \(a+(-2*b)=18+(-6)=12\).
Compare \(12\) with \(c = 12\). Since \(12 = 12\), the second if - condition \((a + - 2*b<=c)\) is true.
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
awesome