Ask your own question, for FREE!
Computer Science 17 Online
SourMunchkin7806:

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++)

SourMunchkin7806:

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

dude:

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++)

dude:

Like that?

SourMunchkin7806:

YEa like that

SourMunchkin7806:

I was thiknking D

dude:

Ya

SourMunchkin7806:

Sweet ok i just got 2 more

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!