跪求pascal语言编写的百钱买百鸡

来源:百度知道 编辑:UC知道 时间:2024/05/17 04:34:51
帮我一下,pascal语言编写的百钱买百鸡的程序可不可以说一下?

3文一公鸡,2文一母鸡,1文3小鸡
var
a,b,c:integer;
begin
for a:=1 to 100 do
for b:=1 to 100 do
for c:=1 to 100 do
if(c mod 3=0)and(a*3+b*2+c div 3=100)and(a+b+c=100)
then writeln(a:4,b:4,c:4)
end.

我用的TP7.0所以省略头文件了。
Var a,b,c : integer;
Begin
for a:=1 to 20 do
for b:=1 to 33 do
Begin
c:=100-a-b;
if (a*5+b*3+c/3=100) then
writeln(a,' ',b,' ',c);
End;
End.

var
a,b,c:integer;
begin
for a:=1 to 100 do
for b:=1 to 100 do
for c:=1 to 100 do
if(c mod 3=0)and(a*3+b*2+c div 3=100)and(a+b+c=100)
then writeln(a:4,b:4,c:4)
End.

到底多少钱一只鸡啊