I need to produce the following using the source code below:
1. Pascal Triangle of a certain degree n (x+y)^n
Should be limited to 11 rows, and shall return and ask for
another round? What shall I do? 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
2. Specific line of Pascal Triangle of a certain n (x+y)^n
Should show the specific line if for example I chose 3 number of
rows... the screen shall display
1 2 1 only
The same for other numbers... what shall edit with my source
code?
3. Rth term coefficient of Pascal triangle at (ax+by)^n
________________________________________________________________________
#include<stdio.h>
int main()
{
int row,c,n,x;
void pasc(int);
printf("\n\nEnter the no. of rows: ");
scanf("%d",&row);
printf("\n\n\n");
printf("\nPascal's triangle :\n\n\n");
for(n=0;n<row;n++)
{
for(c=row-n;c>=0;c--)
printf(" ");
pasc(n);
printf("\n\n");
}
}
void pasc(int n)
{
int r;
long fact(int);
for(r=0;r<=n;r++)
printf("%3ld ",fact(n)/(fact(n-r)*fact(r)));
}
long fact(int v)
{
if(v==1||v==0)
return(1);
else
return(v*fact(v-1));
}
________________________________________________________________________
thank very much for your favorable response...
i'm chad by the way and i would like to study programming.. i'm ]
starting from the least difficult i think...
thank you again!!!
God bless you!!!