this prints it in a weird way...but its a solution, MIND U....ITS USING MATHAmatical induction, so its goign to be accurate upto the nth row.
its a little raw, and very much of a base programmer, coz i wrote this when i started out with c.
-----------------------------------------------------------
//Program to print Pascal Triangle
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
static unsigned long int n,k,i,j,g;
unsigned long int fact(unsigned long int );
void tri(unsigned long int ,unsigned long int );
clrscr();
printf("Enter number\n");
scanf("%ld",&n);
for(i=1;i<=n;i++)
{ g=i+1;
for(j=0;j<=i;j++)
{
k=fact(i)/(fact(i-j)*fact(j));
g--;
tri(k,g);
}
}
getch();
}
//to find factorial of numbers
unsigned long int fact(unsigned long int x)
{
unsigned long int i,j=1,k;
for(i=x;i>=1;i--)
{
j=j*i;
}
return (j);
}
//to draw the triangle
void tri(unsigned long int k,unsigned long int g)
{
printf("%9ld",k);
if(g==0)
printf("\n\n");
}
----------------------------------------------------------------------