for(int i=0, i<2, i++) { for (int j = 0, j+i, j++) { if(j>1) printf(\"*\"); else
ID: 3617811 • Letter: F
Question
for(int i=0, i<2, i++) { for (int j = 0, j+i, j++) { if(j>1) printf("*"); else printf("%d",j); } printf("n"); } what values would we get if we were to enter values for i andj like i j 0 0 0 1 1 0 1 1 1 2 for(int i=0, i<2, i++) { for (int j = 0, j+i, j++) { if(j>1) printf("*"); else printf("%d",j); } printf("n"); } what values would we get if we were to enter values for i andj like i j 0 0 0 1 1 0 1 1 1 2Explanation / Answer
for(int i=0, i<2, i++) { for (int j = 0, j<i, j++) { if(j>1) printf("*"); elseprint f("%d",j); } printf("n"); } whatvalues would we get if we were to enter starting values for i and j like i j output i j print
0 0 n0n 0 0 n j !<i so inner loop doesn't execute
0 1 nn 0 1 n exit j loop
1 1 n exit j loop
2 exit i loop
1 0 0n 1 0 0
1 n exit j loop
2 exit i loop
1 1 n 1 1 n exit j loop
2 exit i loop
1 2 n 1 2 n exit j loop
&n
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.