procedure TForm1.Button1Click(Sender: TObject)
var
src: integer
i: integer
j: integer
m: integer // 判断数值2到i-1能被i整除的个数,m=0则说漏春斗明i为素森游数
begin
m:=0
src:=StrToInt(Edit1.Text)
for i:=src+1 to 2*src do
begin
for j:=2 to i-1 do
begin
if i mod j=0 then
m:=m+1
end
if m=0 then
begin
Label1.Caption:=Label1.Caption+ IntToStr(i)
Exit
end
m:=0
end
end
end.
下仔侍李面的程序供您参考。输谈念入Values和念迟N,输出fMin, fMax, fAvgvar
fMin, fMax, fAvg
I: Integer
begin
fMin := High(Integer)
fMax := - fMin
fAvg := 0
for I := 0 to n - 1 do
begin
fAvg := fAvg + Values[i]
if (Values[i] >fMax)
fMax := Values[i]
if (Values[i] <fMin)
fMin := Values[i]
end
if (n >0)
fAvg := fAvg / n
end
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)