Represent pascals triangle
Delphi & Pascal (česká wiki)
Category: KMP (Club of young programmers)
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Pastroj.pas
File exe: Pastroj.exe
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Pastroj.pas
File exe: Pastroj.exe
Represent pascals triangle.
{ PASTROJ.PAS Copyright (c) Jan Benkovic } { Zobrazi pascalov trojuholnik. } { } { Datum:15.10.1998 http://www.trsek.com } uses crt; const MaxR = 15; var ir : array[1..MaxR] of integer; n,i,j : integer; begin clrscr; for i:= 1 to MaxR do ir[i]:=0; Writeln('Pascalov trojuholnik'); Writeln('--------------------'); repeat Write('Zadaj pocet riadkov (1 - ',MaxR,'): '); readln(n); if (n < 1) or (n>MaxR) then Writeln('Fuuj'); until (n>= 1) and (n<=MaxR); for i:= 1 to n do begin ir[i]:= 1; for j:= i-1 downto 2 do ir[j]:= ir[j]+ir[j-1]; for j:= 1 to i do write(ir[j]:5); writeln; end; readkey; end.