1)
var
a, b, s : real;
begin
read (a, b);
s := a * b;
write (s:10:4);
end.
2)
a, b, c, k : integer;
read (a, b, c);
k := 0;
if a > 0 then inc (k);
if b > 0 then inc (k);
if c > 0 then inc (k);
writeln (k);
3)
a : integer;
read (a);
writeln ((a mod 10) * (a mod 100 div 10) * (a div 100 mod 10) * (a div 1000));
4)
c, n : integer;
read (n);
c := 0;
repeat
inc (c);
n := n div 10;
until n = 0;
writeln (c);
5)
n, sum, i : integer;
sum := 0;
for i := 1 to n do
sum := sum + i;
writeln (sum);
6)
d, n, k : integer;
read (n, k);
d := 0;
while n >= k do
d := d + 1;
n := n - k;
end;
writeln ('n div k = ', d);
writeln ('n mod k = ', n);
7)
n, sum, i, tmp : integer;
read (tmp);
sum := sum + tmp;
writeln (sum / n);
8)
i, n, s : integer;
a : array [1..1000] of integer;
s := 2;
a[i] := s;
s := s + 2 * i + 1;
for i := 1 to n do write (a[i], ' ');
9)
n, i, count, tmp : integer;
count := 0;
if tmp < 0 then inc (count);
writeln (count);
10)
n, i, j : integer;
for j := 1 to i do
write ('*');
writeln;
11) //Не понял, как заполняется массив? Тут рандом
i, n : integer;
a[i] := trunc (random (1000)) - 500;
if a[i] > 0 then a[i] := a[i] * (-1)
else if a[i] < 0 then a[i] := sqr (a[i]);
write (a[i], ' ');
12)
n, i, count : integer;
if n mod i = 0 then inc (count);
program HomeWork;
var k,n,j:integer;
function IsPrime(a:integer):boolean;
var i:integer;
IsPrime:=True;
for i:=2 to a-1 do
if a mod i = 0 then
IsPrime:=False;
break
end
function IsSumEven(a:integer):boolean;
var i,s:integer;
IsSumEven:=False;
s:=0;
while a > 0 do
i:=a mod 10;
a:=a div 10;
s:=s+i
if s mod 2 = 0 then IsSumEven:=True
write('Введите два натуральных числа, разделённые пробелом, K и N ( 2 ≤ K ≤ N ≤ 100000 ): '); readln(k,n);
for j:=k to n do
if IsPrime(j) = True then if IsSumEven(j) = True then write(j, ' ')
1)
var
a, b, s : real;
begin
read (a, b);
s := a * b;
write (s:10:4);
end.
2)
var
a, b, c, k : integer;
begin
read (a, b, c);
k := 0;
if a > 0 then inc (k);
if b > 0 then inc (k);
if c > 0 then inc (k);
writeln (k);
end.
3)
var
a : integer;
begin
read (a);
writeln ((a mod 10) * (a mod 100 div 10) * (a div 100 mod 10) * (a div 1000));
end.
4)
var
c, n : integer;
begin
read (n);
c := 0;
repeat
inc (c);
n := n div 10;
until n = 0;
writeln (c);
end.
5)
var
n, sum, i : integer;
begin
read (n);
sum := 0;
for i := 1 to n do
sum := sum + i;
writeln (sum);
end.
6)
var
d, n, k : integer;
begin
read (n, k);
d := 0;
while n >= k do
begin
d := d + 1;
n := n - k;
end;
writeln ('n div k = ', d);
writeln ('n mod k = ', n);
end.
7)
var
n, sum, i, tmp : integer;
begin
read (n);
sum := 0;
for i := 1 to n do
begin
read (tmp);
sum := sum + tmp;
end;
writeln (sum / n);
end.
8)
var
i, n, s : integer;
a : array [1..1000] of integer;
begin
s := 2;
read (n);
for i := 1 to n do
begin
a[i] := s;
s := s + 2 * i + 1;
end;
for i := 1 to n do write (a[i], ' ');
end.
9)
var
n, i, count, tmp : integer;
begin
read (n);
count := 0;
for i := 1 to n do
begin
read (tmp);
if tmp < 0 then inc (count);
end;
writeln (count);
end.
10)
var
n, i, j : integer;
begin
read (n);
for i := 1 to n do
begin
for j := 1 to i do
write ('*');
writeln;
end;
end.
11) //Не понял, как заполняется массив? Тут рандом
var
a : array [1..1000] of integer;
i, n : integer;
begin
read (n);
for i := 1 to n do
a[i] := trunc (random (1000)) - 500;
for i := 1 to n do
if a[i] > 0 then a[i] := a[i] * (-1)
else if a[i] < 0 then a[i] := sqr (a[i]);
for i := 1 to n do
write (a[i], ' ');
end.
12)
var
n, i, count : integer;
begin
read (n);
count := 0;
for i := 1 to n do
if n mod i = 0 then inc (count);
writeln (count);
end.
program HomeWork;
var k,n,j:integer;
function IsPrime(a:integer):boolean;
var i:integer;
begin
IsPrime:=True;
for i:=2 to a-1 do
begin
if a mod i = 0 then
begin
IsPrime:=False;
break
end
end
end;
function IsSumEven(a:integer):boolean;
var i,s:integer;
begin
IsSumEven:=False;
s:=0;
while a > 0 do
begin
i:=a mod 10;
a:=a div 10;
s:=s+i
end;
if s mod 2 = 0 then IsSumEven:=True
end;
begin
write('Введите два натуральных числа, разделённые пробелом, K и N ( 2 ≤ K ≤ N ≤ 100000 ): '); readln(k,n);
for j:=k to n do
begin
if IsPrime(j) = True then if IsSumEven(j) = True then write(j, ' ')
end
end.