Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { paulogp }
- { mac os 7 }
- program Ada05p;
- uses
- MemTypes, QuickDraw, OSIntf;
- Var
- i, n, fact: integer;
- fim: string;
- begin
- repeat
- clearscreen;
- writeln('Programa: Cálculo de factoriais!');
- repeat
- writeln;
- if n < 0 then write('Introduza o valor de N (POSITIVO): ') else
- write('Introduza o valor de N: ');
- readln(n);
- until n >= 0;
- fact:= 1;
- for i:= n downto 1 do fact:= fact * i;
- writeln;
- writeln(n,'! = ', fact);
- writeln;
- writeln;
- write('Repetir programa (S/N): ');
- readln(fim);
- uprstring(fim, true);
- until fim = 'N';
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement