/* This Program is parscal Triangle output :- 1
11
121
1331
14641
*/
class ParscalTriangle
{
public static void main (String arg[])
{
int r,value,n;
n=Integer.parseInt(arg[0]);
for(int i=0; i<=n; i++)
{
r = i+1;
value = 1;
for(int c=0; c<=i; c++)
{
if(c>0)
{
value = value * (r - c) / c;
}
System.out.print(value + " ");
}
System.out.println();
}
}
}
0 comments:
Post a Comment