Написал код на все задачи, кроме восьмой. Писал так, как понял условие, так что не придирайся там слишком))) Весь код ниже:
Объяснение:
{#1}
var a: array [1..100] of integer;
i,s: integer;
zn: string;
begin
s:= 0;
i:= 0;
writeln('answer on question --- |yes = +| |no = -|');
writeln('enter more? --- ');
readln(zn);
while zn = '+' do
i:= i + 1;
readln(a[i]);
s:= s + a[i];
end;
writeln('sum = ',s);
end.
{#2}
var a,b,c: integer;
s1, s2: real;
writeln('a = ');
readln(a);
writeln('b = ');
readln(b);
writeln('c = ');
readln(c);
s1:= a*b*c;
s2:= 2*(a*b+b*c+a*c);
writeln('s1 = a*b*c = ',s1:0:3);
writeln('s2 = 2*(a*b+b*c+a*c) = ',s2:0:3);
{#4}
for i:= 1 to 20 do
writeln('a[',i,'] = ');
writeln('sum of elements = ',s);
{#5}
i,min: integer;
min:= a[1];
if a[i] < min then min:=a[i];
writeln('minimum of elements = ',min);
{#6}
var i: integer;
rez: real;
rez:= 0;
for i:= 1 to 9 do
rez:= i*9;
writeln(i,' * 9 = ',rez:0:0);
{#7}
var y,x: real;
x:= -5;
while (x >= -5) and (x <= 5) do
y:= abs(x) + 2;
writeln('x = ',x:0:1,' --- y = ',y:0:1);
x:= x + 0.5;
{#8}
(8-ая не сделана)
{#9}
var num: integer;
pr,rez: real;
writeln('enter number of floor --- ');
readln(num);
pr:= num/4;
rez:= round(pr);
if pr > rez then rez:= rez + 1;
writeln(rez:0:0,' number of floor');
{#10}
writeln('enter number --- ');
if num = 5 then num:=num*2;
writeln('number after editing --- ',num);
Написал код на все задачи, кроме восьмой. Писал так, как понял условие, так что не придирайся там слишком))) Весь код ниже:
Объяснение:
{#1}
var a: array [1..100] of integer;
i,s: integer;
zn: string;
begin
s:= 0;
i:= 0;
writeln('answer on question --- |yes = +| |no = -|');
writeln('enter more? --- ');
readln(zn);
while zn = '+' do
begin
i:= i + 1;
readln(a[i]);
s:= s + a[i];
writeln('enter more? --- ');
readln(zn);
end;
writeln('sum = ',s);
end.
{#2}
var a,b,c: integer;
s1, s2: real;
begin
writeln('a = ');
readln(a);
writeln('b = ');
readln(b);
writeln('c = ');
readln(c);
s1:= a*b*c;
s2:= 2*(a*b+b*c+a*c);
writeln('s1 = a*b*c = ',s1:0:3);
writeln('s2 = 2*(a*b+b*c+a*c) = ',s2:0:3);
end.
{#4}
var a: array [1..100] of integer;
i,s: integer;
begin
s:= 0;
for i:= 1 to 20 do
begin
writeln('a[',i,'] = ');
readln(a[i]);
s:= s + a[i];
end;
writeln('sum of elements = ',s);
end.
{#5}
var a: array [1..100] of integer;
i,min: integer;
begin
for i:= 1 to 20 do
begin
writeln('a[',i,'] = ');
readln(a[i]);
end;
min:= a[1];
for i:= 1 to 20 do
begin
if a[i] < min then min:=a[i];
end;
writeln('minimum of elements = ',min);
end.
{#6}
var i: integer;
rez: real;
begin
rez:= 0;
for i:= 1 to 9 do
begin
rez:= i*9;
writeln(i,' * 9 = ',rez:0:0);
end;
end.
{#7}
var y,x: real;
begin
x:= -5;
while (x >= -5) and (x <= 5) do
begin
y:= abs(x) + 2;
writeln('x = ',x:0:1,' --- y = ',y:0:1);
x:= x + 0.5;
end;
end.
{#8}
(8-ая не сделана)
{#9}
var num: integer;
pr,rez: real;
begin
writeln('enter number of floor --- ');
readln(num);
pr:= num/4;
rez:= round(pr);
if pr > rez then rez:= rez + 1;
writeln(rez:0:0,' number of floor');
end.
{#10}
var num: integer;
begin
writeln('enter number --- ');
readln(num);
if num = 5 then num:=num*2;
writeln('number after editing --- ',num);
end.
0 0 0 1 0 1 1
0 0 1 1 0 1 1
0 1 0 0 0 1 1
0 1 1 0 0 1 1
1 0 0 1 1 0 0
1 0 1 1 1 0 1
1 1 0 0 0 1 1
1 1 1 0 0 1 1