program zadagha_1;
var
a: array[1..8] of integer;
i,sum:integer;
begin
writeln('vvedite 8 chisel');
for i:=1 to 8 do read(a[i]);
sum:=0;
for i:=1 to 8 do begin
if i mod 2 <> 0 then begin
sum:=sum+a[i];
writeln(a[i]);
end;
writeln();
writeln('summa elementov c nechetnim N =', sum);
end.
program zadagha_2;
b: array[1..1000] of integer;
i,a,n:integer;
writeln('vvedite chislo - kolichestvo elementov massiva');
readln(n);
for i:=1 to n do begin
b[i]:=random(1000);
write(b[i]:6);
writeln('vvedite chislo');
readln(a);
write ('elementi > dannogo chisla: ');
if b[i]>a then write (i:4);
program zadacha_3;
a: array[1..100] of integer;
i,n,k: integer;
n:=random(100);
a[i]:=random(1000)-500;
write(a[i]:6);
readln(k);
writeln('v massive chisly ',k, ' kratni: ');
if (a[i] mod k = 0) and (a[i]>0) then begin
var x,y:real; i,n:integer;
begin
n:=round((xn-x0)/h)+1;
x:=x0-h;
for i:=1 to n do
begin
x:=x+h;
y:=cos(x/3+0.3);
writeln(x:4:1,y:8:3);
end;
end.
Результат:
0.0 0.955
0.2 0.934
0.4 0.908
0.6 0.878
0.8 0.844
1.0 0.806
1.2 0.765
1.4 0.720
1.6 0.672
1.8 0.622
2.0 0.568
2.2 0.512
2.4 0.454
2.6 0.393
2.8 0.331
3.0 0.267
3.2 0.203
3.4 0.137
3.6 0.071
3.8 0.004
4.0 -0.062
4.2 -0.129
4.4 -0.195
4.6 -0.260
4.8 -0.323
5.0 -0.386
5.2 -0.446
5.4 -0.505
5.6 -0.561
5.8 -0.615
6.0 -0.666
program zadagha_1;
var
a: array[1..8] of integer;
i,sum:integer;
begin
writeln('vvedite 8 chisel');
for i:=1 to 8 do read(a[i]);
sum:=0;
for i:=1 to 8 do begin
if i mod 2 <> 0 then begin
sum:=sum+a[i];
writeln(a[i]);
end;
end;
writeln();
writeln('summa elementov c nechetnim N =', sum);
end.
program zadagha_2;
var
b: array[1..1000] of integer;
i,a,n:integer;
begin
writeln('vvedite chislo - kolichestvo elementov massiva');
readln(n);
for i:=1 to n do begin
b[i]:=random(1000);
write(b[i]:6);
end;
writeln();
writeln('vvedite chislo');
readln(a);
write ('elementi > dannogo chisla: ');
for i:=1 to n do begin
if b[i]>a then write (i:4);
end;
end.
program zadacha_3;
var
a: array[1..100] of integer;
i,n,k: integer;
begin
n:=random(100);
for i:=1 to n do begin
a[i]:=random(1000)-500;
write(a[i]:6);
end;
writeln();
writeln('vvedite chislo');
readln(k);
writeln('v massive chisly ',k, ' kratni: ');
for i:=1 to n do begin
if (a[i] mod k = 0) and (a[i]>0) then begin
write(a[i]:6);
end;
end;
end.