I try this below program which find midpoint between two no.
class FindMidPoint
{
public static void main(String args[])
{
int i, j;
i = 100;
j = 200;
// find midpoint between i and j
while(++i < --j) ;
System.out.println("Midpoint is " + i+" OR "+j);
}
}
Output:
Midpoint is 150 OR 150
But If I make changing in while condition that is
while(i++<j--)
Then output is:
Midpoint is 16 OR 14
I also refer the below Link then also I'm not understanding the difference between ++i & i++ in this program.
what is the difference between i++ & ++i in for loop (Java)?
Please explain me if anyone have idea about.