№3
#include <iostream>
using namespace std;
int main() {
float y, x = 0.2;
if (x < 1)
y = abs(x);
else if (x > 4)
y = 1 + sqrt(x);
else if (0 <= x <= 4)
y = 3.5 + 2 * x;
//наш X войдет в 2 промежутка, выведем первое выполненное условие
cout << y;
return 0;
}
№4
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int x = 3;
float y;
if (x < -2)
y = pow((x+2),2);
else if (-2 <= x <= 0)
y = x+2;
else if (x>= 0)
y = pow((x+2),3);
cout << y;
return 0;
}
project1;
uses
crt,math;
constn=10;
var s:real; i:byte; a:array [1..10] of integer;
begin
for i:=1 to n do
begin
writeln('vvedite ',i,' cifru');readln(a[i]);
end;
for i:=1 to n do
begin
if ((a[i]>-50) and (a[i]<200) and ((a[i] mod 5) = 0)) then s:=s+a[i];
end;
writeln('summa vseh: ',s:2:2);
readln;
end.