Lời giải :
a)
program hotrotinhoc ;
var S,n : integer ;
begin
S:=1;
for i:= 1 to n do
S:=S*i ;
write('S=',S);
readln
end.
b)
program hotrotinhoc ;
var n,k,i,j,a : integer ;
A: Real ;
begin
write('nhap n='); readln(n);
write('nhap k='); readln(k);
for i:= 1 to n do
for j:= 1 to k do
for a:= 1 to (n-k) do
A:=(i*i)/(a*a) ;
write('A=',A);
readln
end.
uses crt;
var n,i:integer;
s,gt:int64;
a:real;
begin
clrscr;
write('nhap n='); readln(n);
write('nhap k='); readln(k);
s:=1;
for i:=1 to n do
s:=s*i;
writeln('S=',s);
gt:=1;
for i:=1 to n-k do
gt:=gt*i;
a:=s/gt;
writeln('A=',a:4:2);
readln;
end.
uses crt;
var n,i:integer;
s,gt:int64;
a:real;
begin
clrscr;
write('nhap n='); readln(n);
write('nhap k='); readln(k);
s:=1;
for i:=1 to n do
s:=s*i;
writeln('S=',s);
gt:=1;
for i:=1 to n-k do
gt:=gt*i;
a:=s/gt;
writeln('A=',a:4:2);
readln;
end.