Could you please give algorithm for printing pascal triangle when an input number is taken which defines number of lines of pascal triangle that it has to print..

don't give me the code directly .. but help me how to crack it...

Printable View

- 05-19-2011suryakCode for pascal triangle
Could you please give algorithm for printing pascal triangle when an input number is taken which defines number of lines of pascal triangle that it has to print..

don't give me the code directly .. but help me how to crack it... - 05-19-2011PING
Have you first tried printing the triangle values without the formatting?

- 05-19-2011suryak
I tried but i am not getting them ..

- 05-19-2011CommonTater
- 05-19-2011pulihora
<<< link to spoon-fed homework snipped >>>

visit this link you will get the code ;) :) - 05-19-2011Bayint Naung
Stop giving code. You are not helping anyone.

- 05-19-2011pulihora
- 05-20-2011nonoob
Pascal's triangle are just rows of sums of the previous row's numbers. Or, each element can be calculated from its X,Y coordinate using factorials. Depending on what you've learned in math.

Binomial coefficient - Wikipedia, the free encyclopedia

The formatting of a nice triangular picture of numbers requires printing spaces and ensuring the numbers all have fixed width and/or are centered. So that's the 2nd part of the problem.