{$A+,B-,D+,E+,F-,G-,I+,L+,N+,O-,P-,Q-,R-,S+,T-,V+,X+} {$M 16384,0,655360} {type ttomb=array[1..maxint] of integer;} uses crt; var fk:extended; fibsz:longint; torony:longint; szamlal:longint; binomn,binomk:integer; type ttomb=char; function fakt(n:extended):extended; begin if n=0 then fakt:=1 else fakt:=n*fakt(n-1); end; function fib(n:longint):longint; begin if n=0 then fib:=1 else if n=1 then fib:=1 else fib:=fib(n-1)+fib(n-2); end; procedure hanoi(n:longint;honnan:ttomb;hova:ttomb;mivel:ttomb); begin if (n>0) then begin hanoi(n-1,honnan,mivel,hova); write(#13,honnan,' -> ',hova,' ',szamlal); hanoi(n-1,mivel,hova,honnan); inc(szamlal); end; end; function binom(n,k:integer):longint; begin if ((n=k) or (k=0)) then binom:=1 else binom:=binom(n-1,k)+binom(n-1,k-1); end; function binom2(n,k:integer):longint; begin if (k=0) then binom2:=0 else binom2:=binom(n,k-1)*( (n-k+1) div k ); end; procedure foprogram; begin {write('Minek a fibje? '); readln(fibsz); if (fibsz>0) then writeln(fib(fibsz)); if (fibsz<>0) then foprogram;} {write('Hany torony? '); readln(torony); if (torony>0) then begin szamlal:=1; hanoi(torony,'a','b','c'); end; if (torony<>0) then foprogram;} write('n? '); readln(binomn); write('k? '); readln(binomk); if ((binomk<>0) and (binomn<>0)) then begin binom2(binomn,binomk); end; if ((binomk<>0) and (binomn<>0)) then foprogram; end; begin clrscr; foprogram; end.