作业帮 > 综合 > 作业

查一下错Free Pascal: 有一个三位数,它的各位数字之和的11倍恰好等于它自身,请编程求出这个三位数.

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/03 08:32:38
查一下错Free Pascal: 有一个三位数,它的各位数字之和的11倍恰好等于它自身,请编程求出这个三位数.
我用Free Pascal做的,就是不能运行,帮忙查一下错:
var a,b,c,s:integer;
begin
for s:=100 to 999 do
begin
a:=a mod 100;
b:=b div 10 mod 10;
c:=c mod 10;
if (a+b+c)*11=s then writeln(s);
end;
readln
end.
var a,b,c,s:integer;
begin
for s:=100 to 999 do
begin
a:=s mod 100; //这三个最开始操作数应该是s,您卖萌了………………
b:=s div 10 mod 10;
c:=s mod 10;
if (a+b+c)*11=s then writeln(s);
end;
readln
end.