Tuesday, May 3, 2011

Program Faktorial

Program Faktorial;
Uses Wincrt;
Var i,n,x:integer;
Begin
  Writeln('Program Faktorial');
  Writeln('=================');
  Writeln;
  Write('Masukkan Nilai Faktorial: ');Readln(n);
  Writeln;
  if (n<=0) then
    Writeln('Hasil Faktorial: ',1)
  else
    Begin
      x:=1;
      For i := 1 to n do
          x:=x*i;
      Writeln('Hasil Faktorial: ',x);
    End;  
End.
Outputnya:

0 comments:

Post a Comment