In how many differents way can I add or substract the iterator on a for loop?

https://www.codecademy.com/courses/learn-c-plus-plus/lessons/cpp-loops/exercises/for

Having a loop like this:
for (int i = 0; i < 10; i++) {
std::cout << i << “\n”;
}

In how many ways can I modificate the “i” iterator?
I know that I actually can add and substract, but I wondered if I could iterate by any number y want (something like iterating 2 by 2 or 4 by 4) I would be very glad if someone answer me <3

Thanks for reading, peace.

Check this link out. Also at the bottom it has a list of common operators.

https://en.cppreference.com/w/cpp/language/operator_incdec

1 Like