Question: 1. Write a for loop (not a whole program) to calculate this series of numbers: 1/10 + 2/9 + 3/8 + .... + 9/2 +

1. Write a for loop (not a whole program) to calculate this series of numbers:

1/10 + 2/9 + 3/8 + .... + 9/2 + 10/1

In addition to giving me the loop, tell me the numeric answer you get if you run it.

2. Write the code needed (not a whole program) that asks the user to enter a value 1-5 and keeps asking them to do so until they enter a valid value.

3. Write the code needed (not a whole program) to do the following:

Generate a random number of 0 or 1 and then print the word Heads or Tails depending upon the random number that was generated.

Note for #3: This does not need to be a loop, though if you wish to do so that is fine with me.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!