Explanatory Question
Differentiate between the following code fragments and also give their output :-
int f = 1, i = 2;
while (++i < 5)
f *= i;
System.out.println(f);
int f = 1, i = 2;
do {
f *= i;
} while (++i < 5);
System.out.println(f);
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.