Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C language 4. One snail is climbing up the tree. For each round, it climb up a random distance between [Ocm, 10cm). Finish the

In C language

image text in transcribed

4. 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

3. What are potential solutions?

Answered: 1 week ago