#include<Stdio.h>
#include<conio.h>
void main()
{
int a[20][20],i,j,n;
clrscr();
printf("\n enter the number of lines:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
if(j==0||i==j)
{
a[i][j]=1;
}
else
{
a[i][j]=a[i-1][j-1]+a[i-1][j];
}
printf("%4d",a[i][j]);
}
printf("\n");
}
getch();
}
No comments:
Post a Comment