1) Program asd; USES crt; Const n=10; Var A:array[1..n] of integer; i,kp,s:integer; BEGIN Writeln('Массив: '); For i:=1 to n do begin A[i]:=Random(20); Write(A[i]:4); end; Writeln; For i:=1 to n do begin If A[i] mod 3=0 then s:=s+1; end; Writeln('Сумма: ' ,s); END.
2) Program asd; USES crt; Const n=10; Var A:array[1..n] of integer; i,kp,s:integer; BEGIN Writeln('Массив: '); For i:=1 to n do begin A[i]:=Random(20)-10; Write(A[i]:4); end; Writeln; For i:=1 to n do begin If A[i]<0 then s:=s+1; end; If s=0 then Writeln('Нет отр. элементов!'); Writeln('Сумма отр. элементов: ' ,s); END.
procedure nod( var dv,tr,pt,dv1,tr1,pt1,dv2,tr2,pt2 :real; ); var a:array[1..6] of real; i : integer; begin dv1:=100; tr1:=100; pt1:=100; for i:= low(a) to high (a) do begin readln(a[i]); repeat if( (a[i] mod 2) =0) then begin a[i]:=a[i]/2; dv:=dv+1; end else if( ( a[i] mod 3)=0) then begin a[i]:=a[i]/3; tr:=tr+1; end else if ( ( a[i] mod 5)=0) then begin a[i]:=a[i]/5; pt:=pt+1; end;
untill(a=1); if dvif trif ptdv:=0; tr:=0; pt:=0; end; if dv1>0 then dv2:=dv1*2 else dv2:=1; if tr1>0 then tr2:=tr1*3 else tr2:=1; if pt1>0 then pt2:=pt1*5 else pt2:=1; nod:=dv2*tr2*pt2; writeln(nod); end; begin nod( dv,tr,pt,dv1,tr1,pt1,dv2,tr2,pt2 ); end.
Program asd;
USES crt;
Const n=10;
Var A:array[1..n] of integer;
i,kp,s:integer;
BEGIN
Writeln('Массив: ');
For i:=1 to n do
begin
A[i]:=Random(20);
Write(A[i]:4);
end;
Writeln;
For i:=1 to n do
begin
If A[i] mod 3=0 then
s:=s+1;
end;
Writeln('Сумма: ' ,s);
END.
2)
Program asd;
USES crt;
Const n=10;
Var A:array[1..n] of integer;
i,kp,s:integer;
BEGIN
Writeln('Массив: ');
For i:=1 to n do
begin
A[i]:=Random(20)-10;
Write(A[i]:4);
end;
Writeln;
For i:=1 to n do
begin
If A[i]<0 then s:=s+1;
end;
If s=0 then Writeln('Нет отр. элементов!');
Writeln('Сумма отр. элементов: ' ,s);
END.
procedure nod( var dv,tr,pt,dv1,tr1,pt1,dv2,tr2,pt2 :real; );
var a:array[1..6] of real;
i : integer;
begin
dv1:=100;
tr1:=100;
pt1:=100;
for i:= low(a) to high (a) do begin
readln(a[i]);
repeat
if( (a[i] mod 2) =0) then begin
a[i]:=a[i]/2;
dv:=dv+1;
end
else if( ( a[i] mod 3)=0) then begin
a[i]:=a[i]/3;
tr:=tr+1;
end
else if ( ( a[i] mod 5)=0) then begin
a[i]:=a[i]/5;
pt:=pt+1;
end;
untill(a=1);
if dvif trif ptdv:=0;
tr:=0;
pt:=0;
end;
if dv1>0 then dv2:=dv1*2 else dv2:=1;
if tr1>0 then tr2:=tr1*3 else tr2:=1;
if pt1>0 then pt2:=pt1*5 else pt2:=1;
nod:=dv2*tr2*pt2;
writeln(nod);
end;
begin
nod( dv,tr,pt,dv1,tr1,pt1,dv2,tr2,pt2 );
end.
end;