for i:=1 to 1000 do begin s:=inttostr(i); for j:=low(s) to high(s) do begin if s[j]=4 or s[j]=6 then flag:=1;break; end; if flag<>1 then sum:=sum+1; end;
多看看PASCAL语法,多看别人的程序.
var i,j,sum:integer; str:string; flag:Boolean; begin for i:=1 to 1000 do begin str:=IntToStr(i); for j:=1 to length(s) do begin if (str[j]='4') or (str[j]='6') then flag:=false; Break; end; if flag<>false then sum:=sum+1; end; end;
var i,sum:integer; str:string; flag:Boolean; begin sum:=0; for i:=1 to 1000 do begin str:=IntToStr(i); flag:=true; if (pos('4',str)>0) or (pos('6',str)>0) then flag:=false; if flag then sum:=sum+1; end; end;
begin
s:=inttostr(i);
for j:=low(s) to high(s) do
begin
if s[j]=4 or s[j]=6 then
flag:=1;break;
end;
if flag<>1 then
sum:=sum+1;
end;
i,j,sum:integer;
str:string;
flag:Boolean;
begin
for i:=1 to 1000 do
begin
str:=IntToStr(i);
for j:=1 to length(s) do
begin
if (str[j]='4') or (str[j]='6') then
flag:=false;
Break;
end;
if flag<>false then sum:=sum+1;
end;
end;
i,sum:integer;
str:string;
flag:Boolean;
begin
sum:=0;
for i:=1 to 1000 do
begin
str:=IntToStr(i);
flag:=true;
if (pos('4',str)>0) or (pos('6',str)>0) then
flag:=false;
if flag then sum:=sum+1;
end;
end;