program GCD;
function findGCD(a, b: integer): integer;beginif b = 0 thenfindGCD := aelsefindGCD := findGCD(b, a mod b);end;
varnum1, num2: integer;result: integer;
beginwriteln('Enter first number: ');readln(num1);writeln('Enter second number: ');readln(num2);
result := findGCD(num1, num2);
writeln('GCD of ', num1, ' and ', num2, ' is ', result);end.
program GCD;
function findGCD(a, b: integer): integer;
begin
if b = 0 then
findGCD := a
else
findGCD := findGCD(b, a mod b);
end;
var
num1, num2: integer;
result: integer;
begin
writeln('Enter first number: ');
readln(num1);
writeln('Enter second number: ');
readln(num2);
result := findGCD(num1, num2);
writeln('GCD of ', num1, ' and ', num2, ' is ', result);
end.