在Delphi坏境下编写"百钱买百鸡"的程序

来源:百度知道 编辑:UC知道 时间:2024/05/29 20:08:16
程序不要太复杂··看不懂啊

procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c:Integer;
begin
for a:=0 to 19 do
begin
for b:=1 to 33 do
begin
c:=100-a-b;
if ((5*a+3*b+c div 3)=100) and ((c mod 3)=0) then
ShowMessage('5元一只的有:'+inttostr(a)+'只'+#13+'3元一只的有:'+inttostr(b)+'只'+#13+'一元钱3只的有:'+inttostr(c)+'只');
end;
end;
end;