hello,
i have problem with show correctness of these 2 algorithms:
alg1
prime(n)
q:=2; results:=true;
while (q< n and results) do
begin
if n mod q=0 then results:=false;
q := q + 1;
end;
if results then "prime number"
else "number isn't prime"
----------------------------------
alg2 (Factorial n!)
sil(n)
begin
sil := 1;
m := n;
while m > 0 do
begin
sil := sil*m;
m := m-1;
end;
end


LinkBack URL
About LinkBacks