program fantscrin;
var x_1,x_2,h,j,i: integer; f: boolean; a: array [1..3] of string; k,l: string;
function chek_number(a: integer): boolean;
var k: integer;
begin
if (a mod 2 < > 0) then
begin
chek_number: =false;
exit;
end;
while a > 0 do
begin
a: =a div 10;
k: =k+1;
end;
if (k = 3) then chek_number: =true
else chek_number: =false;
end;
begin
f: =false;
while f = false do
begin
write('введите 1-ое число: '); readln(x_1);
f: =chek_number(x_1);
end;
f: =false;
while f = false do
begin
write('введите 2-ое число: '); readln(x_2);
f: =chek_number(x_2);
if (f) then if (x_1 < > x_2) then f: =true
else f: =false;
end;
str(x_2,l);
str(x_1,k);
i: =1;
h: =1;
while i< =3 do
begin
j: =1;
while j< =3 do
begin
if (k[i] = l[j]) then
begin
a[h]: =k[i];
h: =h+1;
end;
j: =j+1;
end;
i: =i+1;
end;
writeln('');
i: =1;
while i < =3 do
begin
write (a[i], ' ');
i: =i+1;
end;
end.
1)
#include <iostream>
#include <math.h>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
float x, y;
cout << "Введите х:";
cin >> x;
if (x <= 0) {
y = 3 * sin(x) - pow(cos(x), 2) * x;
cout << y;
}
else if (x > 0) {
y = sqrt(1 + pow(x, 2));
cout << y;
}
else {
y = log(x + 5);
cout << y;
}
return 0;
}
2)
#include <iostream>
#include <math.h>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
float x, f;
cout << "Введите х:";
cin >> x;
if (x < 0) {
f = 3/pow((x-3),2);
cout << f;
}
else if (0<=x<=2) {
f = x-1;
cout << f;
}
else if(x>2) {
f = log(x);
cout << f;
}
return 0;
}
Объяснение: