Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Is there anyone to help me to fix my code? Something is wrong here and i dont know what it is. I still don't have

Is there anyone to help me to fix my code? Something is wrong here and i dont know what it is.
I still don't have the correct output for this C code
here are the pictures of the question and Code in C
image text in transcribed
image text in transcribed
It is known that the volume of a sphere is ar". Write a script in whatever language you like that confirms this using the Monte Carlo method. Approach: Consider a sphere with radius r contained within a cube with dimensions (2r 2r x 2r) and center at (0,0,0). Any point within that cube would have coordinates q = {91:92:03) where el Sr. If that point is also within the sphere, it must satisfy: 3 q'q = Hispa If you randomly generate a number of points within that cube (n) and determine how many also lie within the sphere (m), the ratio of the number of points that lie within the sphere to the total number of points (m) should be approximately equal to the ratio of the volume of the sphere to the volume of the cube: m 8 In your code, accept inputs for the radius r and the number of points. Randomly generate coordinates for each point and determine how many of the points lie within the sphere. Use this count to approximate the volume of the sphere. Print to the screen the exact and Approximate volumes Monte Carte Mathed) a My Me Monte Carlo Method) Mora Carles Mathed) mana) and include adio. Int sain() 10 int 1. 1.... D..sum : 12 int matat2010). mata(103103, result 2013 13 printf("Enter number of rows and colums of later) 16 SALES". 15 printf("Enter the Matrix for (i = 1 rest BO > printf("product of the Matrix ) for tl -1 1 % 5 27 $ 4 9 6 8 3 P 0 1 U Y R T

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions