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

State some facts about Germany from 1880s- 1940s, the Nazi Party, and Adolf Hitler
How can we prepare for climate change?? Plzzzzzzzz helppppppo
3. There are 6 places set at each table for the big outdoor party. All the tables and chairs have 4 legs each, and altogether the tables and chairs have a total
What is better electric or gas cars.
C. Did any hominids have a larger cranial capacity than humans? If so, which species?
At current sales revenue of $2,400, total variable costs are $960 and total fixed costs are $900. Your boss gave you a profit target of $1,800. How much do you
( Please give me a good answer) How are index fossils and rock layers used to support relative dating?
Do you know what is menstruation ? Please elaborate.​
If (a+b)(a-b)=21,a+b=7 and a-b=3 what Is the value of a
who built fort le boeuf