Question: In C language Please answer each question separately. One snail is climbing up the tree. For each round, it climb up a random distance between

In C language Please answer each question separately. One snail is climbingIn C language

Please answer each question separately.

One snail is climbing up the tree. For each round, it climb up a random distance between (Ocm, 10cm). Finish the following problems: Write a function named calculate_dis. This function has one parameter n with int type, and should output the total distance that the snail has climbed in the n rounds. (2 marks) Write a function named rounds_ needed. This function has one parameter D with int type, and should output the total rounds that the snail will take to climb up no less than D cm. (2 marks) Under the assumption that D=100, calculate rounds_ needed(D) for multiple (no less than 100) times (with different starting seeds to generate different random numbers each time). Based on the result, please answer: What is the average value of rounds_ needed(D) in your experiment? (1 mark) What is the relation between D and rounds_ needed(D)? Please explain the reason. (1 mark)

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!