- Back to Home »
- PATTERN PROGRAMS »
- C PROGRAM TO PRINT PASCAL TRIANGLE OF TYPE 2
Posted by : ANIMESH SHAW
Tuesday, 20 September 2011
#include<stdio.h>
#include<conio.h>
main()
{
int a[20][20],i,j,rows,num=25,k;
printf("\n enter the number of rows:");
scanf("%d",&rows);
for(i=0;i<rows;i++)
{
for(j=0;j<=i;j++)
{
if(j==0||i==j)
{
a[i][j]=1;
}
else
{
a[i][j]=a[i-1][j]+a[i-1][j];
}
printf("%4d",a[i][j]);
}
printf("\n");
}
getch();
}
#include<conio.h>
main()
{
int a[20][20],i,j,rows,num=25,k;
printf("\n enter the number of rows:");
scanf("%d",&rows);
for(i=0;i<rows;i++)
{
for(j=0;j<=i;j++)
{
if(j==0||i==j)
{
a[i][j]=1;
}
else
{
a[i][j]=a[i-1][j]+a[i-1][j];
}
printf("%4d",a[i][j]);
}
printf("\n");
}
getch();
}

very good !!!
great collection for c programmers .keep going
wish you very best luck