ayushpoudel833 ayushpoudel833
  • 21-06-2021
  • Computers and Technology
contestada

write an algorithm to find perimeter of circle
​

Respuesta :

sk5634943
sk5634943 sk5634943
  • 28-07-2021

Answer:

Here’s one!

Given [math]R[/math], the radius of the circle.

Let [math]N,D\leftarrow 0[/math]

Repeat until [math]D[/math] is large enough (about 1,000,000)

[math]x,y\leftarrow U[0,1][/math]

If [math]x^2 + y^2\le 1[/math] then [math]N\leftarrow N+1[/math]

[math]D\leftarrow D+1[/math]

[math]P\leftarrow\frac{8NR}{D}[/math]

Return [math]P[/math]

[math]U[0,1][/math] is a uniform random number in the range [math][0,1][/math].

Explanation:

Answer Link

Otras preguntas

Need help to Write 4.01 as a percent
What are the four basic parts found in all cells?
what is .02439 repeating as a fraction
The sum of 2a and 3b
please help me write an algebraic expression equation.   then solve these percent problems.A $150 leather jacket is going on sale for a 25% discount. How
When i add 2 to my number and then multiply it bye 5 i get 30 what is my number
Which term is used for the tendency of an object to resist a change in its motion? A. acceleration B. displacement C. momentum D. inertia
You are going to roll two dice. Let the variable x = the sum of the numbers rolled. What is the probability that x = 9 ?
What is 7:9 in simplist form
Helpers are needed to prepare for the fete. Each helper can make either 2 large cakes per hour, or 35 small cakes per hour. The kitchen is available for 3 hour