Var x1, x2, y1, y2: integer; O: boolean; begin write('X1: '); readln(x1); write('Y1: '); readln(y1); write('X2: '); readln(x2); write('Y2: '); readln(y2); if (x1 < 0) and (x2 < 0) and (y1 < 0) and (y2 < 0) then O:=true; if (x1 < 0) and (x2 < 0) and (y1 > 0) and (y2 > 0) then O:=true; if (x1 > 0) and (x2 > 0) and (y1 > 0) and (y2 > 0) then O:=true; if (x1 > 0) and (x2 > 0) and (y1 < 0) and (y2 < 0) then O:=true; if O = true then write('TRUE') else write('FALSE'); end.
Код C++
1#include <iostream>
2
3 int main()
4{
5 setlocale (LC_ALL, "Russian");
6 int a = 0, b = 0, P = 0;
7
8 std::cout << "Введите катеты прямоугольника!" << std::endl;
9 std::cout << "a = "; std::cin >> a;
10 std::cout << "b = "; std::cin >> b;
11
12 P = 2 * (a + b);
13
14 std::cout << "Периметр: " << P << std::endl;
15
16 system("pause");
17 return 0;
18 }
O: boolean;
begin
write('X1: ');
readln(x1);
write('Y1: ');
readln(y1);
write('X2: ');
readln(x2);
write('Y2: ');
readln(y2);
if (x1 < 0) and (x2 < 0) and (y1 < 0) and (y2 < 0) then O:=true;
if (x1 < 0) and (x2 < 0) and (y1 > 0) and (y2 > 0) then O:=true;
if (x1 > 0) and (x2 > 0) and (y1 > 0) and (y2 > 0) then O:=true;
if (x1 > 0) and (x2 > 0) and (y1 < 0) and (y2 < 0) then O:=true;
if O = true then write('TRUE')
else write('FALSE');
end.