#include<stdio.h>
int main()
{
int i,j,k,n,b;
printf("Enter the number of rows= ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
b=1;
for(k=0;k<=n-i;k++)
printf(" ");
for(j=0;j<=i;j++)
{
if(i==0 || j==0)
printf("1");
else
{ b=b*(i-j+1)/j;
printf("%3d",b);
}
}
printf("\n\n");
}
return 0;
}
int main()
{
int i,j,k,n,b;
printf("Enter the number of rows= ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
b=1;
for(k=0;k<=n-i;k++)
printf(" ");
for(j=0;j<=i;j++)
{
if(i==0 || j==0)
printf("1");
else
{ b=b*(i-j+1)/j;
printf("%3d",b);
}
}
printf("\n\n");
}
return 0;
}
1 comment:
Finally, tune ye program dal hi diya....
Post a Comment