Wednesday, December 26, 2012

Java Exercise #99: Sierpinski Triangle

Sierpinski triangle is created as follows:

    • Begin with an equilateral triangle, which is Sierpinski triangle of order 0.
      Connect the midpoints of the sides of triangle of order 0 to create Sierpinski triange of order 1.
      Leave the center triangle intact.
      Repeat the same process recursively to create Sierpinski triangle of order 3, 4 etc..
  • Exercise: Use recursion to write a program that creates Sierpinski triangles of the order which is input by the user.

    Download Code: Sierpinski Triangle

    No comments:

    Post a Comment