Sunday, September 18, 2011

Day 019: Pascal Program

Although the Oak C Program might be misleading, I actually do get into programming for real.

Pascal's Triangle
Heard of Pascal's Triangle? Thing used for binomial coefficients? No...? Well it works like this nice animation to the right:

Each cell is the sum of the two cells above it.

My instructor was like, "Hey, why don't you make a program that displays Pascal's Triangle up to a certain row?"

And I was like, "Hey, why don't I?" So I went ahead and made a whole application.

ELEMENT - print specific cell from triangle at given row & column e.g. ("element 3 2")
EXIT - exits the program
HELP - helps you out with stuff: taxes, dog, etc.
ROW - print specific row from triangle
UPTOROW - print triangle up to certain row

If you ever need to explore Pascal's Triangle, my C program should do the trick.


Want it? Excellent...

Problems:
  1. You have to type in lowercase
  2. If you only type (e.g.) "uptorow" without a number it'll wait until you type the number, refusing to tell you to do so in order to give you a hard time
Will I fix them? Probably not.

No comments:

Post a Comment