(* Iterative factorial with block structure and strings *)
MODULE Factorial;

FROM InOut IMPORT WriteString, WriteInt, WriteLn;

VAR n, result: INTEGER;

BEGIN
  n := 6;
  result := 1;
  WHILE n > 1 DO
    result := result * n;
    n := n - 1;
  END;

  WriteString("6! = ");
  WriteInt(result, 0);
  WriteLn;
END Factorial.
