Chương trình Dùng Function tạo tam giác Pascal

Program Tam_Giac_Pascal;
Uses Crt;
Var i,j,n,k:integer;
Function gt(n:integer):longint; Var kq,i:integer;
Begin
kq:=1;
For i:=1 to n do kq:=kq*i;
gt:=kq;
End;
Function C(k,n:integer):real;
Begin
C:=gt(n)/(gt(k)*gt(n-k));
End;

Begin
Clrscr;
Writeln(‘VIET TAM GIAC PASCAL:’);
Write(‘ Nhap n = ‘); readln(n);
For i:=0 to n do
Begin
For j:=0 to i do
Write(C(j,i):3:0); Writeln;
End;

Readln;

End.