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
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...
Have you first tried printing the triangle values without the formatting?
I tried but i am not getting them ..
<<< link to spoon-fed homework snipped >>>
visit this link you will get the code ;) :)
Stop giving code. You are not helping anyone.
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.