#include<stdio.h>
#include <conio.h>
void main()
{
int line,c,n,x;
void pasc(int);
printf("\n\nInsert, how much line do you want: ");
scanf("%d",&line);
printf("\n\n\n");
printf("\nPascal's Triangle Is : (press enter)\n");
for(x=line-1;x>=0;x--)
printf(" ");
printf(" 1\n\n");
for(n=2;n<=line;n++)
{
for(c=line-n;c>=1;c--)
printf(" ");
pasc(n);
printf("\n");
getche();
}
}
void pasc(int n)
{
int r;
long fact(int);
for(r=0;r<=n;r++)
printf("%3ld ",fact(n)/(fact(n-r)*fact(r)));
}
long fact(int v)
{
if(v==1||v==0)
return(1);
else
return(v*fact(v-1));
}
i don't know, what's wrong with my code. if you run, you will get the wrong output ini 13th line... oh yeah, i'm indonesian, so please forgive me, if my english is very bad.. :mrgreen: