em muon ve tam giac Pascal nhung em moi ve dc co
**** 1
*** 1 1
** 1 2 1
* 1 3 3 1
*...nnnnnnn....
Cac bac giup em voi!!!!
May cai "**" khong can phai in ra a!!
- Code:
#include "conio.h"
#include "stdio.h"
main ()
{
int a[100][100],i,j,n;
printf("Nhap so hang can in ra (khong vuot qua 100):");
scanf("%d",&n);
for (i=1; i<=n;i++)
for (j=1; j<=n;j++)
a[i][j]=0;
for (j=1;j<=n;j++)
{
a[1][j]=1;
a[j][j]=1;
}
for (i=3;i<=n;i++)
for (j=2;j<=i;j++)
{
a[i][j]=a[i-1][j-1]+a[i-1][j+1];
}
printf("Ket Qua:\n");
for (j=1;j<=n;j++)
{
for (i=1;i<=j;i++)
{
printf(" %d",a[i][j]);
}
printf("\n");
}
getch();
}
**** 1
*** 1 1
** 1 2 1
* 1 3 3 1
*...nnnnnnn....
Cac bac giup em voi!!!!
May cai "**" khong can phai in ra a!!