program p9_a_2 uses crt var nod integer nok real begin clrscr write Vv

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
program p9_a_2; {7 A 2.1}
uses crt;
var a,b,k,i, nod : integer; nok : real;
begin
clrscr;
write('Vvedite chisla a,b : '); readln(a,b);
if (a > b) then k := b else k := a;
nod := 1;
for i := 1 to k do
if ((a mod i = 0) AND (b mod i = 0) AND (nod < i)) then
nod := i;
nok := (a*b)/nod;
writeln('NOD(a,b) = ', nod);
writeln('NOK(a,b) = ', nok:2:2);
readln;
end.