For while loop you should increment the counter as the last statement and then it will be equivalent.

Do while loops are a bit different and cannot be equal to for loop but in your case applying the increment as the last statement of the loop would do.