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;
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);
#include <cmath>
using namespace std;
double eps = 0.000001;
double sq(double a, double b, double c)
{
double p = (a + b + c) / 2;
return sqrt(p * (p - a) * (p - b) * (p - c));
}
int main()
{
double a1, b1, c1, a2, b2, c2;
cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
if (sq(a1, b1, c1) >= sq(a2, b2, c2) - eps && sq(a1, b1, c1) <= sq(a2, b2, c2) + eps)
cout << "YES";
else
cout << "NO";
}
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.