1. program pr1; uses crt; var n,k,i,t:integer; begin clrscr; write('Введите целое число n='); readln (n); for i:=2 to n do begin t:=0; for k:=2 to n do if i mod k=0 then t:=t+1; if t=1 then write(i:3); end; readln; end.
2.
Program pr2; Var a, b: Integer;
Function NOD(a, b: Integer): Integer; Var tmp, r: Integer; Begin If b > a Then Begin tmp := a; a := b; b := tmp; End; tmp := a; While tmp > 0 Do Begin Result := tmp; tmp := tmp - b; End; End;
1. program pr1; uses crt; var n,k,i,t:integer; begin clrscr; write('Введите целое число n='); readln (n); for i:=2 to n do begin t:=0; for k:=2 to n do if i mod k=0 then t:=t+1; if t=1 then write(i:3); end; readln; end.
2.
Program pr2; Var a, b: Integer;
Function NOD(a, b: Integer): Integer; Var tmp, r: Integer; Begin If b > a Then Begin tmp := a; a := b; b := tmp; End; tmp := a; While tmp > 0 Do Begin Result := tmp; tmp := tmp - b; End; End;
program pr1;
uses crt;
var n,k,i,t:integer;
begin
clrscr;
write('Введите целое число n=');
readln (n);
for i:=2 to n do begin
t:=0;
for k:=2 to n do
if i mod k=0 then t:=t+1;
if t=1 then write(i:3);
end;
readln;
end.
2.
Program pr2;
Var a, b: Integer;
Function NOD(a, b: Integer): Integer;
Var tmp, r: Integer;
Begin
If b > a Then
Begin
tmp := a;
a := b;
b := tmp;
End;
tmp := a;
While tmp > 0 Do
Begin
Result := tmp;
tmp := tmp - b;
End;
End;
Begin
Write('a = ');
ReadLn(a);
Write('b = ');
ReadLn(b);
Write('НОД: ', NOD(a, b));
ReadLn;
End.
program pr1;
uses crt;
var n,k,i,t:integer;
begin
clrscr;
write('Введите целое число n=');
readln (n);
for i:=2 to n do begin
t:=0;
for k:=2 to n do
if i mod k=0 then t:=t+1;
if t=1 then write(i:3);
end;
readln;
end.
2.
Program pr2;
Var a, b: Integer;
Function NOD(a, b: Integer): Integer;
Var tmp, r: Integer;
Begin
If b > a Then
Begin
tmp := a;
a := b;
b := tmp;
End;
tmp := a;
While tmp > 0 Do
Begin
Result := tmp;
tmp := tmp - b;
End;
End;
Begin
Write('a = ');
ReadLn(a);
Write('b = ');
ReadLn(b);
Write('НОД: ', NOD(a, b));
ReadLn;
End.