function monte_carlo_simulation(iterations)
inside_circle = 0
for _ in 1:iterations
if x^2 + y^2 <= 1
inside_circle += 1
end
end
return (inside_circle / iterations) * 4
end
iterations = 1_000_000
@
time pi_estimate
= monte_carlo_simulation
(iterations
)println("EstimaciĆ³n de Pi: ", pi_estimate)
ZnVuY3Rpb24gbW9udGVfY2FybG9fc2ltdWxhdGlvbihpdGVyYXRpb25zKQogICAgaW5zaWRlX2NpcmNsZSA9IDAKICAgIGZvciBfIGluIDE6aXRlcmF0aW9ucwogICAgICAgIHgsIHkgPSByYW5kKCksIHJhbmQoKQogICAgICAgIGlmIHheMiArIHleMiA8PSAxCiAgICAgICAgICAgIGluc2lkZV9jaXJjbGUgKz0gMQogICAgICAgIGVuZAogICAgZW5kCiAgICByZXR1cm4gKGluc2lkZV9jaXJjbGUgLyBpdGVyYXRpb25zKSAqIDQKZW5kCgppdGVyYXRpb25zID0gMV8wMDBfMDAwCkB0aW1lIHBpX2VzdGltYXRlID0gbW9udGVfY2FybG9fc2ltdWxhdGlvbihpdGVyYXRpb25zKQpwcmludGxuKCJFc3RpbWFjacOzbiBkZSBQaTogIiwgcGlfZXN0aW1hdGUpCg==