Question: . When the following is executed, the output is 2, What would the programmed will do the code to get the output as 8?
. When the following is executed, the output is 2, What would the programmed will do the code to get the output as 8? (Hint: Please do not change the values) public class AnswerTest { public static void main(String[] args) { int i 42 + 45 - 48 - 5; int 5+ 5 - 8 + 2; int ansi % j; System.out.printf("%d", ans); } [02 Marks]
Step by Step Solution
There are 3 Steps involved in it
To get the output as 8 we need to modify the calculation for the variable i so that it r... View full answer
Get step-by-step solutions from verified subject matter experts
