Vykreslí Pascalov trojuholník
Delphi & Pascal (česká wiki)
Kategorija: Zadaňa zos Pascalu
Zrobil: Pheo
web: pascalsource.ic.cz
Program: Pas_trojuholnik.pas
Subor exe: Pas_trojuholnik.exe
Zrobil: Pheo
web: pascalsource.ic.cz
Program: Pas_trojuholnik.pas
Subor exe: Pas_trojuholnik.exe
Vykreslí Pascalov trojuholník.
{ PAS_TROJUHOLNIK.PAS Copyright (c) Pheo } { Pascalov trojuholník. } { } { Datum:24.05.2000 http://www.trsek.com } program pascalov_trojuholnik; uses crt; {const n=18;} var a: array[1..18,0..18] of integer; r,i,j,n,k:integer; begin clrscr; writeln('pocet riadkov'); read(n); for i:=1 to n do begin a[i,0]:=0; a[i,i+1]:=0; end; a[1,1]:=1;r:=31; for k:=1 to r do write(' '); r:=r-2; writeln(a[1,1]:5); for i:=2 to n do begin for k:=1 to r do write(' '); r:=r-2; for j:=1 to i do begin a[i,j]:=a[i-1,j-1]+a[i-1,j]; write(a[i,j]:5); end; writeln; end; readln; repeat until keypressed; end.