class Program
{
public static void main(String[] args)
{
int i,n=6,c;
Program prg =new Program();
prg.fact(n);
for (i = 0; i < n; i++)
{
for (c = 0; c <= (n - i - 2); c++)
System.out.print (" ");
for (c = 0; c <= i; c++)
System.out.print ( prg.fact(i) / (prg.fact(c) * prg.fact(i - c)));
System.out.print ("\n");
}
}
long fact(int n)
{
int c;
long result = 1;
for( c = 1 ; c <= n ; c++ )
result = result*c;
return ( result );
}
}
No comments:
Post a Comment