Formula for pascal triagle at n row
C = C * (line - i) / i;
Just create a loop to print value at line n
int c=1;
for(int i=1;i<=n;i++)
{
System.out.print(c+" ");
c=c*(n-i)/i;
}
Just create a loop to print value at line n
int c=1;
for(int i=1;i<=n;i++)
{
System.out.print(c+" ");
c=c*(n-i)/i;
}
0 Comments:
Post a Comment