Answered step by step
Verified Expert Solution
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
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 (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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started