Var
x,y:real;
begin
readln(x);
if x<-3 then y:=-2*x+15;
if (x>-3) and (x<2) then y:=2*cos(x)*sin(x);
if x>2 then y:=log10(x+4);
writeln(y);
end.
Var n,a,b,c,d:integer;
begin
readln(n);
for a:=1 to n-1 do
for b:=a to n-1 do
begin
d:=a*a+b*b;
c:=1;
while c*c<d do c:=c+1;
if (d=c*c)and(c<n) then writeln(a,' ',b,' ',c);
end;
end.
Пример:
20
<span>3 4 5
5 12 13
6 8 10
8 15 17
9 12 15</span>
Исходный массив:
1 2 3 4 5 6 7 8 9 10 11
Далее, каждому элементу начиная с нулевого, присваиваем значение массива с таким же индексом, но считая с конца и получаем:
11 10 9 8 7 6 7 8 9 10 11
Мышь, Процессор, Принтер, Бумага, Калькулятор.
//FPC 2.6.4
Program sieve_of_Eratosthenes;
var
n, i, x:integer;
a: array[1..32000] of boolean;
begin
readln(n);
for i:=2 to (n+1) div 2 do
begin
x:=i*2;
while x<=n do
begin
a[x]:=true;
x:=x+i;
end;
x:=0;
end;
for i:=1 to n do if not a[i] then write(i,' ');
readln;
end.