Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project2;
- {$APPTYPE CONSOLE}
- uses
- SysUtils,
- Math;
- function Fact(N: Integer): Integer;
- begin
- if N < 0 then Result := -1
- else if N = 0 then Result := 1
- else Result := N * Fact(N-1);
- end;
- function GetUniqueChars(S: String): String;
- var
- UniqueChars: array of Char;
- CS: Integer;
- begin
- if Length(S) > 1 then
- begin
- UniqueChars := '';
- for CS := 1 to Length(S) do
- {TODO}
- end
- else
- UniqueChars := S;
- Result := UniqueChars;
- end;
- var
- N: Integer;
- S: String;
- begin
- try
- {$I-}
- Readln(N);
- {$I+}
- if IOResult <> 0 then
- begin
- Writeln('Error! Please enter something more understandable next time...');
- Readln;
- Exit;
- end;
- N := Fact(N);
- if N = -1 then
- begin
- Writeln(
- 'The correct value for the factorial function ' +
- 'is a non-negative integer.'
- );
- Readln;
- Exit;
- end;
- if N <= 0 then
- begin
- Writeln('Out of Boundaries Error!');
- Readln;
- Exit;
- end;
- S := IntToStr(N);
- //S := GetUniqueChars(S);
- Writeln(S);
- Readln;
- except
- raise;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement