The Rantings of a Teenager in the Prime Crap-itude of High School

Friday, May 26, 2006

Pascal's Triangle Program

Ok, Just cuz we're doing a bunch of Pascal's Triangle crap in amth, here's a program to find any line of it.

The Key sequence to make the program (from the main screen):

[PRGM] [>] [>] [ENTER] [2nd] [ALPHA] [8] [MATH] [LN] [PRGM] [MATH] [)] [LN] [ENTER]
[0] [STO>] [ALPHA] [APPS] [ENTER]
[PRGM] [>] [ENTER] [2nd] [ALPHA] [+] [PRGM] [7] [SIN] [COS] [.] [+] [ALPHA] [,] [X] [ENTER]
[PRGM] [0] [3]
[PRGM] [9] [1]
[ALPHA] [APPS] [+] [1] [STO>] [ALPHA] [APPS] [ENTER]
[PRGM] [1] [X] [-] [ALPHA] [APPS] [2nd] [MATH] [5] [0] [ENTER]
[PRGM] [0] [2] [ENTER]
[PRGM] [9] [3] [ENTER]
[PRGM] [>] [X] [MATH] [>] [>] [3] [ALPHA] [APPS] [ENTER]
[PRGM] [8] [ENTER]
[PRGM] [0] [1] [ENTER]
[PRGM] [9] [2] [ENTER]
[PRGM] [ALPHA] [COS]

~finished~

Ok, so now if you want to see what tha should look like, here's the code:

:0>B
:Input "COEF",X
:Goto 3
:Lbl 1
:B+1>B
:If X-B<0
:Goto 2
:Lbl 3
:Disp X nCr B
:Pause
:Goto 1
:Lbl 2
:Stop

~finished~

I know that the code could be cleaner, usng while loops and the like, but whatever. I made this prgm last year (1st semestre I think), and it's short enough as is. Only 13 lines, but its got 3 Labels!


Anyways, here you go Jane. And any other moochers who want Pascal's triangle.

~Motor.On

4 Comments:

Blogger Jane said...

thank you!! :)

7:14 PM

 
Blogger Cody said...

go dress up like a girl again and put it on the net...I'd bet you it would get on ebaums!!!

1:05 AM

 
Blogger Scott said...

I don't even know where to start with that one...

Do you have fantasies about alan in drag?

2:03 AM

 
Blogger Motor.On said...

At least Im not sad enought o post as anony on my OWN BLOG. *cough* *cough*

1:49 PM

 

Post a Comment

<< Home