hello every1
i made a factorial program and the only thing i need to do is to validate:
Whether it is empty or it contains letters
Here's the code:

``````program factorial;
uses wincrt;

var
counter:integer;
number:integer;
total:longint;

Begin
total:=1;
counter:=1;
while (counter<=number) do
Begin
total:=(total*counter);
counter:=(counter+1)
end;
Writeln('Factorial=',total);
end.``````

any help will be apreciated. Thanks

simple I/O checking... :D

``````program factorial;
uses wincrt;

var
counter:integer;
number:integer;
total:longint;

Begin
{\$I-}   {checking off}
{\$I+}   {checking on}
{if the IoResult is not zero then alert the user}
If (IoResult <> 0)Then Begin
End
Else Begin
total:=1;
counter:=1;
while (counter<=number) do
Begin
total:=(total*counter);
counter:=(counter+1)
end;
Writeln('Factorial=',total);
End;
end.``````
commented: Looking good +33

a part not working
when i enter a letter, it displays Wrong char please enter a number! (that's great), but when i enter a number, the program stop working (inactive)

repeat..until loop?

``````program factorial;
uses wincrt;

var
counter:integer;
number:integer;
total:longint;

Begin
Repeat
{\$I-}   {checking off}
{\$I+}   {checking on}
total:=1;
counter:=1;
while (counter<=number) do
Begin
total:=(total*counter);
counter:=(counter+1);
Write(total,',');
end;
WriteLn;
Until IoResult<>0;
end.``````

its not working
when a letter is entered, an error occur and program terminate. The first one was better, just need to make it work the the message
WRONG CHAR, PLEASE JUST NUMBER! thats all

We need a condition,understand it please.Cause it will a neverending loop.... :'(

``````program factorial;
uses wincrt;

var
counter:integer;
number:integer;
total:longint;
n:Byte;

Begin
n:=0;
Repeat
{\$I-}   {checking off}
{\$I+}   {checking on}
If IoResult <> 0 Then Write('Wrong char,enter number please')
Else
total:=1;
counter:=1;
while (counter<=number) do
Begin
total:=(total*counter);
counter:=(counter+1);
Write(total,',');
end;
WriteLn;
n:=n+1;
Until n=5;