A programmer needs to simulate 10 trials. During each trial, a coin is flipped 1,000 times. Which loop structure best represents the code needed to accomplish this task? for(int f = 0; f < 1000; f++) for(int t = 0; t < 10; t++) for(int f = 1; f < 1000; f++) for(int t = 1; t < 10; t++) for(int t = 0; t < 10; t++) for(int f = 0; f < 1000; f++) for(int t = 1; t < 10; t++) for(int f = 1; f < 1000; f++) for(int t = 0; t < 10; t++) for(int f = t; f < 1000; f++)
So these are in sets of two so 1 and 2 lines are the answer for A and 3 and 4 are for B and so on
A) for(int f = 0; f < 1000; f++) for(int t = 0; t < 10; t++) B) for(int f = 1; f < 1000; f++) for(int t = 1; t < 10; t++) C) for(int t = 0; t < 10; t++) for(int f = 0; f < 1000; f++) D) for(int t = 1; t < 10; t++) for(int f = 1; f < 1000; f++) E) for(int t = 0; t < 10; t++) for(int f = t; f < 1000; f++)
Like that?
YEa like that
I was thiknking D
Ya
Sweet ok i just got 2 more
Join our real-time social learning platform and learn together with your friends!