Difference between revisions of "CSC220 Homework 2 2010"
(→Problem #1) |
(→Problem #1) |
||
Line 23: | Line 23: | ||
submit hw2 hw2_1.php | submit hw2 hw2_1.php | ||
+ | * Hints: | ||
+ | ** Do not reinvent the wheel. It is acceptable to lookup the algorithm for computing Pascal's triangle. | ||
+ | ** Do not hesitate to code in a different language, as a way to approach this. If Java is more comfortable for you, do the coding in Java first, to prove to yourself that you understand the algorithm, then pass to Php. | ||
<br /> | <br /> | ||
<br /> | <br /> |
Revision as of 13:52, 22 September 2010
--D. Thiebaut 18:45, 22 September 2010 (UTC)
Contents
Problem #1
- Write a Php program that displays the first 10 rows of Pascal's Triangle in a table using loops and arrays. The first 5 lines of the array are shown below.
1 | ||||
1 | 1 | |||
1 | 2 | 1 | ||
1 | 3 | 3 | 1 | |
1 | 4 | 6 | 4 | 1 |
- Store your Php program in a file called hw2_1.php and submit it as follows:
submit hw2 hw2_1.php
- Hints:
- Do not reinvent the wheel. It is acceptable to lookup the algorithm for computing Pascal's triangle.
- Do not hesitate to code in a different language, as a way to approach this. If Java is more comfortable for you, do the coding in Java first, to prove to yourself that you understand the algorithm, then pass to Php.