Home /
Expert Answers /
Computer Science /
please-do-it-step-by-step-and-show-values-for-each-step-thank-you-trace-through-the-code-below-pa314
(Solved):
Please do it step by step and show values for each step, thank
you.
Trace through the code below. ...
Please do it step by step and show values for each step, thank
you.
Trace through the code below. After each section, fill in the boxes for each variable with the values they would contain at that point in the programs run. int \( x=0, y=2, z=4, i=0 \); for \( ; i<3 ; x+=3, z++, i++) \) \( y+=2 \) \begin{tabular}{|l} \hline\( x \) \\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|} \hline\( x \) & y & z & \\ \hline & & & \\ \hline \end{tabular} while \( (i>0 \& \&>0) \) \{ \( z-=2 ; \) if \( ( \) i \( \% 2=0) \) continue; \( -i \); \} \begin{tabular}{|l|l|l|} \hline\( x \) & \( y \) & \( z \) \\ \hline & & \\ \hline \end{tabular} for \( (; ;) \) \{ \( x=y \) if \( (i=9) \) \( \quad \) break; \( z++ \) i++; \} \begin{tabular}{|l|l|l|} \hline\( x \) & \( y \) & \( z \) \\ \hline \end{tabular}
Answer : part(a.) : int x = 0, y = 2, z = 4, i = 0; for(; i<3; x+=3,z++,i++) y+=2; Explanation : The for loop will execute till the value of i is less than 3 that means for i = 0, i = 1 and i = 2. When i = 0 , then loop will run and update the value