Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedIn 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

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

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago