var a, b, с: integer;
begin
write('Введите два числа: ');
readln(a, b);
if a < b then с := a + 1 else с := b + 1;
repeat с := с - 1
until (a mod с = 0) and (b mod с = 0);
write('NOD = ', с)
end.
//2. Алгоритм с вычитанием (цикл while)
var a, b: integer;
begin
write('a = ');
readln(a);
write('b = ');
readln(b);
while a <> b do
if a > b then
a := a - b
else
b := b - a;
writeln('NOD = ', a);
end.
import random
tables = []
# Создаем таблицы
for i in range(3):
temp = []
for j in range(3):
temp.append(random.randint(-100, 100))
tables.append(temp)
print(temp)
# Замена на слова
for table in tables:
for i in range(len(table)):
if table[i] < 0:
table[i] = "отрицательное"
elif table[i] > 0:
table[i] = "положотильное"
else:
table[i] = "ноль"
for table in tables:
print(table)