Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Procedure triangle_pascal (Var t:tab;n:Integer);
- Var
- i,j,l,c: Integer;
- Begin
- //saisie de N
- repeat
- Writeln ('Saisir N');
- Readln (n);
- until (0<n) and (n<15);
- //remplissage des bords du triangle de 1
- For i:=1 To n Do
- Begin
- t[i,1] := 1;
- t[i,i] := 1;
- End;
- //remplissage du reste du triangle avec la formule (T[l, c] = T[l-1, c] + T[l-1, c-1])
- For i:=3 To n Do
- For j:=2 To n-1 Do
- t[i, j] := t[i-1, j] + t[i-1, j-1];
- //affichage de la matrice
- For i:=1 To n Do
- Begin
- Writeln;
- For j:=1 To i Do
- Write (t[i,j],' | ');
- End;
- End;
Add Comment
Please, Sign In to add comment