Calculate pascal triangle with one dementional array.
#include <stdio.h>
// Calculate pascal triangle with one dementional array
void main(){
int j,i,arr[100] , numLine ;
printf(" Calculate pascal triangel. Enter the number of elements you want ? ");
scanf("%d",&numLine);
arr[0]=1;
for (j=1; j<numLine; j++) printf(" ");
printf("%4d \n",arr[0]);
for (i=1; i<numLine; i++) {
arr[i] = 1;
for (j=i-1; j>=1; j--) arr[j] = arr[j] + arr[j-1];
for (j=i+1; j<numLine; j++) printf(" ");
for (j=0; j<=i; j++) printf("%4d",arr[j]);
printf("\n");
}
}