how would you write a for loop that calculates the total investment over 40 years if a one pays $500 each month but every 2 years the payment increases 10%?

//Begin loop: 0 to 40 (years)
//Year_Total = Year_total + Monthly_payment * 12
//If the Loop_Counter / 2 has no remainder, then it has to be a "2nd Year"
//Monthly_payment = Monthly_payment * 1.10
//End Loop

how would you write a for loop that calculates the total investment over 40 years if a one pays $500 each month but every 2 years the payment increases 10%?

I wouldn't. Instead, I would post in a forum by disguising the question by asking the members in the forum, how would they write this. Actually, come to think of it, your statement above would suffice as a disguised question.