SJSU/Udacity CS046

Lesson 6.2 - Loops

  1. Quiz: Input Validation
  2. The Do Loop
  3. Quiz: Accept Values Between 0 and 100
  4. How to Read Multiple Values
  5. Processing Sentinel Values
  6. Quiz: Average
  7. Quiz: Average with Q as Sentinel
  8. Quiz: Average of No Inputs
  9. Quiz: NaN
  10. Quiz: Find The Maximum
  11. Quiz: Reading from File
  12. Quiz: The Most Populous Country
  13. Common Algorithms
  14. Quiz: Counting Matches
  15. Quiz: Counting Matching Digits
  16. Quiz: Finding the First Match
  17. Quiz: What If There Are No Long Words?
  18. Quiz: Fix the Long Word Finding Code
  19. Quiz: Finding the Position of the First Match
  20. Quiz: Nested For Loops
  21. Quiz: Clock Times
  22. Quiz: Triangle Pattern
  23. Quiz: Telescope
  24. Quiz: Random Numbers
  25. Quiz: Computing Pi with Darts
  26. Quiz: Throwing a Die
  27. Quiz: The Chevalier de Meré
  28. Quiz: Estimating Pi Using Buffon Way
  29. Quiz: Using the Debugger 1
  30. Quiz: Using the Debugger 2
  31. Quiz: Using the Debugger 3
  32. Quiz: Using the Debugger with Sara 1
  33. Quiz: Using the Debugger with Sara 2
  34. Quiz: Using the Debugger with Sara 3
  35. Quiz: Hello Yellow Peach
  36. Quiz: Figuring out What is Wrong
  37. Quiz: What Happens Next
  38. Quiz: How Would We Fix That
  39. Quiz: Let us Fix the Code
  40. Fixing the code

Quiz: Estimating Pi Using Buffon Way

This program is not a good way for computing the value of π . You need π in the computation of the angle. It's hidden in the Math.toRadians method.

Still, it's pretty amazing to see the simulation confirm what Buffon did by hand.

Problem on this page?

Your name:

Your email address:

Problem description:

To protect against spam robots, please answer this simple math problem:
× =