Here are some questions to ask yourself about any loop (in any problem):
(1) Am I computing something inside a loop that does not depend on the loop variable? Then compute it outside the loop instead.
(2) Is my loop bound as tight as possible? Am I looping through a lot of cases that can be ruled out and skipped?
(3) Am I computing something in the loop-test (the middle part of the for-loop) that doesn't depend on the loop variable? Then compute it beforehand.
(4) Am I computing the same thing twice within the loop? Then compute it only once and assign it to another variable.
(5) Could I write some of the initializations and updates inside the "for"? For example:
for(i=0,isq=0; isq < n; i++,isq = i*i)
instead of initializing and updating isq elsewhere. (A "comma expression" consists of two expressions separated by a comma. A comma expression is evaluated by evaluating the comma-separated expressions in left-to-right order. A for-loop needs three expressions separated by semicolons; those expressions can be comma expressions, as illustrated here.)
(6) If the loop is a while-loop, could I rewrite it as a for-loop? Usually for-loops are easier to read and maintain, and probably easier to write correctly in the first place, since they help you organize the initialization and update parts of the loop.
(7) If the loop uses break or continue or goto , are they used correctly?
(8) Did I handle the "boundary conditions" correctly? That is, the upper and lower limits of the loop, and the places where the inequality in the loop-continuation test just barely holds or just barely fails, are common sources of error, so check if you have them right or not.