Write a for loop to increment index variable by 2 in each iteration
Answers
Answered by
5
int main()
{
// for loop with two variable i & j
// i will start with 0 and keep on incrementing till 10
// j will start with 10 and keep on decrementing till 0
for (int i = 0, j = 10; i < 10 && j > 0; i++, j--)
{
std::cout << "i = " << i << " :: " << "j = " << j << std::endl;
}
return 0;
}
Similar questions