Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { paulogp }
- { mac os 7 }
- program Ada03p;
- uses
- MemTypes, QuickDraw, OSIntf;
- var
- a, b, x, y, resto: integer;
- fim: string;
- begin
- repeat
- clearscreen;
- writeln('Programa: Cálculo do Maior Divisor Comum.');
- writeln(' Algoritmo de Euclides.');
- writeln;
- write('Introduza o valor de A: ');
- readln(a);
- writeln;
- write('Introduza o valor de B: ');
- readln(b);
- x:= a;
- y:= b;
- while b <> 0 do
- begin
- resto:= a mod b;
- a:= b;
- b:= resto;
- end;
- writeln;
- writeln('O Máximo Divisor Comum de ', x, ' e ', y, ' é ', a, '.');
- 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