Program Faktorial_pascal;
uses wincrt;
function Faktorial(a:integer):longint;
begin
if (A=1)then
Faktorial:=1
else
Faktorial:=a*faktorial(a-1);
end;
var
x:integer;
begin
clrscr;
writeln('Program Penghitung Faktorial');
writeln;
write('Berapa Faktorial : ');readln(x);
writeln(x,' faktorial ','= ',faktorial(x));
end.
uses wincrt;
function Faktorial(a:integer):longint;
begin
if (A=1)then
Faktorial:=1
else
Faktorial:=a*faktorial(a-1);
end;
var
x:integer;
begin
clrscr;
writeln('Program Penghitung Faktorial');
writeln;
write('Berapa Faktorial : ');readln(x);
writeln(x,' faktorial ','= ',faktorial(x));
end.
0 komentar:
Posting Komentar