#include<stdio.h>
main()
{
int i,j,n,k,sp; int c;
printf("Enter the no.of lines that you wanted to print:");
scanf("%d",&n);
sp=n;
for(i=0;i<n;i++)
{
c=1;
for(k=sp;k>=0;k--)
{
printf(" ");
}
sp--;
for(j=0;j<=i;j++)
{
printf("%8d",c);
c=c*(i-j)/(j+1);
}
printf("\n");
}
}
output:
Do more on patterns please.
ReplyDelete