Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from math import *
  2. from random import *
  3. import time
  4.  
  5. nombrePoint = 0
  6. nombrePointRetenus = 0
  7. pi = 0
  8. while nombrePoint <= 100000000:
  9.     pointX = random()
  10.     pointY = random()
  11.     nombrePoint = nombrePoint + 1
  12.     if sqrt(pointX**2 + pointY**2) <= 1:
  13.         nombrePointRetenus = nombrePointRetenus + 1
  14.     pi = 4*(nombrePointRetenus/nombrePoint)
  15.     print (pi)
  16. print ("le resulat final est = " + pi)
  17. time.sleep(100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement