a) What is the exact output of the code below if we execute the function call q2(20)?
void q2(int n)
{
for (int i = 1; i < n; i *= 2)
cout << i;
}
b) The function in part (a) uses a for loop. Rewrite the function using a while loop without changing how the code works.
c) Rewrite the function from part (a) using a do-while loop. (Hint: make sure the code produces the same output for all cases).