program Pascal;
var a,b,c,p,i,f,cit,m,rst,o:integer;
begin
writeln('Dati tipul de operatie: ');
writeln('1) Produsul');
writeln('2) Citul');
writeln('3) Restul');
readln(o);
writeln('Dati doua numere:');
readln(a,b);
case o of
1 :begin
{Produsul}repeat
p:=p+a;
i:=i+1;
until i=b;
writeln('Produsul:=',p);
end;
2 :begin{Citul}
i:=1;
cit:=cit+a;
repeat
if cit>b then
begin
cit:=cit-b;
i:=i+1;
end
else
begin
f:=1;
end;
until f>0;
writeln('Citul:=',i);
end;
3 :begin{Restul}
i:=1;
cit:=cit+a;
repeat
if cit>b then
begin
cit:=cit-b;
m:=m+b;
end
else
begin
f:=1;
end;
if f>0 then
begin
rst:=a-m;
end;
until rst>0;
writeln('Restul:=',rst);
end;
end;
readln;
end.