What will be the output of the following code?
int m = 2;
int n = 15;
for(int i = 1; i < 5; i++) {
m += i; // m = m + i
n -= i; // n = n - i
}
System.out.println("m = " + m); // Output for m
System.out.println("n = " + n); // Output for n
Views 14
Answer:
Output:
m = 12
n = 5
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.