Нужно просто их посчитать
Там 6 едениц и 1 ноль
#include <iostream>
using namespace std;
int main()
{
int a, b, nod;
int k=0;
cin >> a >> b;
while (a*b != 0){
if (a>b) a -=b;
else b -= a;
k++;
}
nod = a+b;
cout << nod << " " << k;
return 0;
}
Пример:
14 21
7 3
Const n=3;
type lec=record
name:string;
cost:integer;
end;
var a:array [1..n] of lec;
max1:integer;
m,k,p,i:byte;
begin
for i:=1 to n do
with a[i] do begin
writeln ('Введи наименование товара');
readln (name);
writeln ('введи стоимость товара');
readln (cost);
end;
max1:=-1;
for i:=1 to n do
if a[i].cost>max1 then begin max1:=a[i].cost;
p:=i;
end;
while k<>1 do begin
for i:=1 to n do
if (i<>p) and (a[i].cost=max1) then begin m:=i;
k:=1;
end;
max1:=max1-1;
end;
writeln (a[p].name,' ',a[p].cost);
write (a[m].name,' ',a[m].cost);
readln;
end.
Var s:int64;
a,b,i:longint;
beginassign(input,'d.in');
reset(input);
assign(output,'d.out');
rewrite(output);
s:=0;
read(a,b);
if odd(a) then i:=a else i:=a+1;
while i<=b dobegins:=s+i;
inc(i,2);
end;
writeln(s);
<span>end.</span>