Can anyone tell how to print a pascal's triangle...

i've wriiten a code but it is not printing the triangle as the way iwanted it to..

here is my code:

```
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[50][50],x,y;
clrscr();
printf("Enter the number rows:\t");
scanf("%d",&n);
for(x=0;x<n;x++)
{
for(y=0;y<=x;y++)
{
if((y==x)||(y==0))
{
a[x][y] = 1;
}
else
{
a[x][y] = a[x-1][y-1]+a[x-1][y];
}
printf("%4d",a[x][y]);
}
printf("\n\n");
}
getch();
}
```

My output is:

Enter the number of rows: 5

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

But i want the output as:

------------------- 1

----------------- 1 1

----------------- 1 2 1

---------------- 1 3 3 1

can anyone help me.....????

thanks