C Programming - Program Membuat Segitiga Pascal
Sunday, June 26, 2011 at 2:53 PM#include <stdio.h>
int bil, a, i, j, k;
int main()
{
int pascal(int);
printf("Masukkan sebuah nilai: ");
scanf("%d", &bil);
for (i=0; i<=bil; i++)
{
for (k=0; k<=((2*bil)-(2*i)); k++)
{
printf(" ");
}
for (j=0; j<=i; j++)
{
pascal(j);
}
printf("\n");
}
return 0;
}
int pascal(j)
{
if (j==0||i==j)
{
a=1;
}
else
{
a=a*(i+1-j)/j;
}
printf("%4i", a);
}