# Thread: Code for pascal triangle

1. ## Code 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...

2. Have you first tried printing the triangle values without the formatting?

3. I tried but i am not getting them ..

4. Originally Posted by suryak
I tried but i am not getting them ..
Then post your code... lets see what's going on....

5. <<< link to spoon-fed homework snipped >>>
visit this link you will get the code

6. Stop giving code. You are not helping anyone.

7. Originally Posted by Bayint Naung
Stop giving code. You are not helping anyone.
thats fine sorry

8. 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.