Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- i,c,p,n:integer;
- a:array [1..1000] of integer;
- function nod(m,n:integer):integer;
- begin
- while m <> n do
- if m > n then
- m:=m - n
- else
- n:=n - m;
- nod:=m;
- end;
- begin
- readln(n);
- p:=1;
- for i:= 1 to n do
- readln(a[i]);
- c:=nod(a[1],a[2]);
- p:=p * a[1] * a[2];
- for i:= 3 to n do
- begin
- c:=nod(c,a[i]);
- p:=p*a[i];
- end;
- writeln('NOD = ',c,' NOK = ',p / c);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement