test2.txt

来自「pl0文法编译器」· 文本 代码 · 共 21 行

TXT
21
字号
const z=0,ch="";
var head,foot,cock,rabbit,n:integer;
begin
	n := z;
	write("input the number of heads",ch);
	read(head);
	write("input the number of feet",ch);
	read(foot);
	cock := 1;
	while cock <= head do
	begin
		rabbit := head - cock;
		if cock*2+rabbit*4 = foot then
		begin
			write("number of cocks is: ",cock,"number of rabbits is: ",rabbit);
			n:=n+1;
		end;
		cock := cock+1;
	end;
	if n=0 then write("number of cocks is: ",0,"number of rabbits is: ",0);
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?