for extra credit i have been given the option of creating a php script that will print out a ppascal triangle
ex.
1
11
121
1331
14641
and im wondering if there is a funtion i don't know about that will allow me to create variables within a for loop?
i would include the code i have soo far but thaats on another computer, i may edit this post at lunch
Pascal triangle
Moderator: General Moderators
the first link i found:
http://mathworld.wolfram.com/PascalsTriangle.html
explains all you need to implement it....
a little websearch will probably give you some code too...
http://mathworld.wolfram.com/PascalsTriangle.html
explains all you need to implement it....
a little websearch will probably give you some code too...
? You can create variables anywhere:...and im wondering if there is a funtion i don't know about that will allow me to create variables within a for loop?
Code: Select all
$foo = 3;
for ($i=0; $i<4; $i++) {
$bar = 5;
if ($bar) {
$baz = 8;
echo $bar;
}
}- asi0917
- Forum Commoner
- Posts: 41
- Joined: Thu Nov 25, 2004 10:37 am
- Location: Shoreline, Washington
- Contact:
your response was the most helpful,timvw wrote:the first link i found:
http://mathworld.wolfram.com/PascalsTriangle.html
explains all you need to implement it....
a little websearch will probably give you some code too...
i think theres a way i can plot the numbers of the triangle on a proverbial "grid" using Mersenne numbers and Fibonacci numbers but i don't have to time to spew some code right now
thanks for the help