answersLogoWhite

0

the logic i have used is nCr => n!/(r!*(n-r)!) for example the outer loop counter is 'n' and the inner loop counter is 'r' , then the corresponding element of the pascal's triangle will be nCr. keep in mind that both the loops will have to start from zero. #include<stdio.h> main()

{

int num,i,j,k,space;

int difffact=1,diff,n,r,x,y,comb=0,nfact=1,rfact=1;

printf("please enter the number of lines\n");

scanf("%d",&num); k=num-1;

space=num-1;

for(i=0;i<num;i++)

{

k=space--;

for(;k>0;k--)

{

printf(" ");

}

for(j=0;j<=i;j++)

{

comb=0;

nfact=1;

rfact=1;

difffact=1; for(n=i;n>=1;n--)

nfact=nfact*n; for(r=j;r>=1;r--)

rfact=rfact*r; diff=i-j;

for(;diff>=1;diff--)

difffact=difffact*diff; comb=(nfact/(rfact*difffact));

printf("%d ",comb);

}

printf("\n");

}

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Flowcharting of pascal triangle?

draw a flowchart of pascal triangle using for loops


Why did blaise pascal important contribution?

Blaise Pascal invented the Pascaline and Pascal's Triangle. Pascal's Triangle was a triangle, which started of with 1. The number underneath is worked out by adding the two numbers above it together. Using Pascal's Triangle, we can find many patterns, including Triangle Numbers.


Who invented Pascal's triangle?

Pascal's triangle was invented by Blaise Pascal (1623-1662) in 1653. Although it has been named after blaise pascal, there have been traces of the triangle, long before Blaise Pascal was born. It is belived that the Persians and the Chinese had been using it to find the square and cube root of numbers. Whoever asked this question is a complete idiot, because the answer is in the question.


How do you expand multinomials?

One way to expand multinomials is using Pascal's triangle.


Make a pascal using c plus plus?

Please make your question more clear. Qhat do you want to do? Rewrite the programming language Pascal? Convert c++ code to Pascal? Create a Pascal triangle? Make a baby son that's called Pascal? (btw, that last thing has to be done in hardware)


How do you do a project on Designs and patterns using arithmetic progressions?

You can use a couple different methods for this. Using Pascal's triangle you can keep making shapes that are bigger proportionally.


Are languages and compilers application softwares?

No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.


How can you use the pattern in the table of combinations to find a number in pascals triangle?

To find a number in Pascal's Triangle using combinations, you can use the formula (C(n, k) = \frac{n!}{k!(n-k)!}), where (n) is the row number and (k) is the position in that row. Each number in Pascal's Triangle corresponds to a combination, where the top of the triangle represents (C(0, 0)), the next row (C(1, 0)) and (C(1, 1)), and so on. By identifying the desired row and position, you can apply the combinations formula to calculate the specific number in Pascal's Triangle.


How can you make a ms-dos com program?

You would need to write it using a software development system that includes a compiler and an integrated development environment. Turbo Pascal and Euphoria are two programming languages you could use.


What did Blaise Pascal contribute to mathematics?

Pascal's triangle. It is named after the French mathematician, Blaise Pascal in much of the Western world, although other mathematicians studied it centuries before him in India, Greece, Iran, China, Germany, and Italy. The rows of Pascal's triangle are conventionally enumerated starting with row n = 0 at the top. The entries in each row are numbered from the left beginning with k = 0 and are usually staggered relative to the numbers in the adjacent rows. (Wikipedia)The top of the triangle -11 11 2 11 3 3 11 4 6 4 1And you can continue on, using the same rules.


What is file processing in pascal language?

is the way a file is design using a pascal language


What are different counting techniques?

What are the different counting techniques