1) var n:integer; begin readln(n); if(n<0)then write(0) else write(n+4); end.
2) var a, b: integer; begin readln(a, b); if(a = b) then write(1) else write(0); end.
3) var a, b, c, s: integer; begin s := 0; readln(a, b, c); if(a >= 0) then s := s + 1; if(b >= 0) then s := s + 1; if(c >= 0) then s := s + 1; write(s); end.
4) var a, b, c, s: integer; begin s := 0; readln(a, b, c); if(a > 0) then s := s + a; if(b > 0) then s := s + b; if(c > 0) then s := s + c; write(s); end. 5) var a, b, c: integer; begin readln(a, b, c); if (a < b) then swap(a, b); if (a < c) then swap(a, c); if (b < c) then swap(b, c); write(a, ' ', b, ' ', c); end.
6) var n, k, s, i: integer; begin s := 0; readln(n, k); for i := 1 to n.ToString.Length do if(strtoint(n.ToString[i]) > k) then s := s + strtoint(n.ToString[i]); write(s); end.
7) var n, s, i: integer; begin s := 0; readln(n); for i := 1 to n do s := s + i; write(s); end.
9) var n, i: integer; begin readln(n); for i := n downto 1 do write(i); end.
12 var n, i: integer; s: real; begin s := 0; readln(n); for i := n downto 1 do s:=s+(0.1*i); write(s); end.
13) var n, i: integer; begin readln(n); for i := 1 to n do write(sqr(i), ' '); end.
14) var n, i, c: integer; begin i := 1; c := 0; readln(n); while (c <> n) do begin if(i mod 3 = 0) then begin write(i, ' ');c := c + 1; end; i := i + 1; end; end.
15) var n, i, a: integer; c: real; begin i := 1; c := 0; readln(n); for i := 1 to n do begin read(a); c := c + a; end; write(c / n) end.
16) var n, i, a: integer; begin i := 1; while true do begin read(a); if(a = 0) then break; n := n + 1; end; write(n) end.
var
n:integer;
begin
readln(n);
if(n<0)then write(0)
else write(n+4);
end.
2)
var
a, b: integer;
begin
readln(a, b);
if(a = b) then
write(1)
else
write(0);
end.
3)
var
a, b, c, s: integer;
begin
s := 0;
readln(a, b, c);
if(a >= 0) then s := s + 1;
if(b >= 0) then s := s + 1;
if(c >= 0) then s := s + 1;
write(s);
end.
4)
var
a, b, c, s: integer;
begin
s := 0;
readln(a, b, c);
if(a > 0) then s := s + a;
if(b > 0) then s := s + b;
if(c > 0) then s := s + c;
write(s);
end.
5)
var
a, b, c: integer;
begin
readln(a, b, c);
if (a < b) then swap(a, b);
if (a < c) then swap(a, c);
if (b < c) then swap(b, c);
write(a, ' ', b, ' ', c);
end.
6)
var n, k, s, i: integer;
begin
s := 0;
readln(n, k);
for i := 1 to n.ToString.Length do
if(strtoint(n.ToString[i]) > k) then s := s + strtoint(n.ToString[i]);
write(s);
end.
7)
var n, s, i: integer;
begin
s := 0;
readln(n);
for i := 1 to n do
s := s + i;
write(s);
end.
9)
var n, i: integer;
begin
readln(n);
for i := n downto 1 do
write(i);
end.
12
var
n, i: integer;
s: real;
begin
s := 0;
readln(n);
for i := n downto 1 do
s:=s+(0.1*i);
write(s);
end.
13)
var n, i: integer;
begin
readln(n);
for i := 1 to n do
write(sqr(i), ' ');
end.
14)
var
n, i, c: integer;
begin
i := 1;
c := 0;
readln(n);
while (c <> n) do
begin
if(i mod 3 = 0) then begin write(i, ' ');c := c + 1; end;
i := i + 1;
end;
end.
15)
var
n, i, a: integer;
c: real;
begin
i := 1;
c := 0;
readln(n);
for i := 1 to n do
begin
read(a);
c := c + a;
end;
write(c / n)
end.
16)
var
n, i, a: integer;
begin
i := 1;
while true do
begin
read(a);
if(a = 0) then break;
n := n + 1;
end;
write(n)
end.
Объяснение:
1. Пронумеруем разряды:
3-й разряд - 4;
2-й разряд - 1;
1-й разряд - 5;
0-й разряд - 3.
4153₈=4·8³+1·8²+5·8¹+3·8⁰
2. 4153₈=4·8³+1·8²+5·8¹+3·8⁰=2048+16+40+3=2155₁₀
3. 125/8=15 (5)
15/8=1 (7)
(1)
125₁₀=175₈
4. Пронумеруем разряды:
2-й разряд - A;
1-й разряд - 6;
0-й разряд - E;
A6E₁₆=(10)(6)(14)=10·16²+6·16¹+14·16⁰
5. A6E₁₆=10·16²+6·16¹+14·16⁰=2560+96+14=2670₁₀
6. 350/16=21 (14=E)
21/16=1 (5)
(1)
350₁₀=15E₁₆
7. 247/2=123 (1)
123/2=61 (1)
61/2=30 (1)
30/2=15 (0)
15/2=7 (1)
7/2=3 (1)
3/2=1 (1)
(1)
247₁₀=11110111₂
247/8=30 (7)
30/8=3 (6)
(3)
247₁₀=367₈
247/16=7 (15=F)
(7)
247₁₀=7F₁₆
Получившиеся числа между собой равны, так как имеют одинаковое число в десятичной системе счисления.