Kizspy | Question: 25
(Choose 1 answer)
Which of the following algorithms are recursive?
(i)
procedure ABC(n, P: integers)
P:=0;
for j=1 to n
begin
end
if (j mod 2 0) then
P: =P -j;
else P: = P + j;
(ii) procedure ABC(n, P: integer)
P: = 1;
for j=1 to n
begin
if (j mod 2 =0) then
P: = P+j
end
else P: = P*j
A. None of them
B. Only (i)
C. Only (ii)
D. Both of them