how to write for loop in different ways in c++ code example Example: for loop in c++ for (int i = 0; i < 10; i++) { cout << i << endl; }