I need to do if the
ivariable is greater than10then check thegcondition and if it is equal to1complete the loop...
Your usage to Conditional operator there is wrong.
Instead, you should be simply using logical && operator there
for (int i = 0, g = 12; /*first condition*/ && /* second condition */ ; i++, g--) // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Therefore, you need:
for (int i = 0, g = 12; i < 10 && g >= 1 ; i++, g--) // ^^^^^^^^^^^^^^^^ The above loop will first check whether the ii is less than 10, if true will check the next condition which is g is grater than or equal to 1: if that is also true: do the iteration!