procedure TForm1.Button1Click(Sender: TObject);
var temp,s,i,j:integer;
begin
s:=1;
while s<100 do
begin
for i:=1 to 100 do
begin
temp:=1;
for j:=1 to i do
temp:=temp*i;
s:=s*temp;
end;
end;
label1.caption:=inttostr(s);
end;
运行时label里面没有结果,这是哪里错了,求高人指教
var temp,s,i,j:integer;
begin
s:=1;
while s<100 do
begin
for i:=1 to 100 do
begin
temp:=1;
for j:=1 to i do
temp:=temp*i;
s:=s*temp;
end;
end;
label1.caption:=inttostr(s);
end;
运行时label里面没有结果,这是哪里错了,求高人指教
解决方案 »
- DCOM+中间层ADOStoredProc传递参数无效问题
- About 'DataModule' And 'MDI'
- 如何做出边角为圆形的按钮,现在delphi里的按钮边角都是直角的,有什么控件可以用吗,
- ======如何真正关闭ClientSocket控件与服务器连接的端口!======
- 毕业题(解决者,要啥给啥,分不够再开帖给)
- 关闭后自启动程序
- 求助sql 问题,都有分
- delphi7中设置dbgird的某一个符合条件的单元格的字体或是背景 变成黄色
- shaver做爸爸了,给大家散散分同喜
- word出错的问题,为什么说variant does not reference an automation object,怎么不能回答?
- 类似360安全卫士的800多K的安装包是怎么做成的?
- 求救,Delphi7下ADOQuery新增数据时出错
rsa算法必需的
procedure Test;
var
s,n,t: Integer;
begin
n := 0;
t := 1;
s := 1;
repeat
inc(n);
s := t;
t := S * N * N;
until t > 100000000;
Dec(N); ShowMessage(Format('S=%d, N=%d, t=%d',[s, n, t]));
end;
继续循环下去,结果真不敢想象呀,而外面还有while循环
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormPaint(Sender: TObject);
var temp,s,i,j:dword;
n:integer;
Overflow:boolean;
begin
s:=1;
n:=0;
Overflow:=false;
for i:=1 to 100 do
begin
temp:=i;
for j:=2 to i do
if (temp*temp>100000000)or(temp*temp<1) then
begin
Overflow:=true;
break;
end
else temp:=temp*i;
if Overflow then break
else if (temp*s>100000000)or(temp*s<1) then break
else s:=s*temp;
inc(n);
Canvas.TextOut(30,n*20,inttostr(temp)+' n='+inttostr(n));
end;
Canvas.TextOut(30,(n+1)*20,format('合题意的数为:%d ; n = %d ',[s,n]));
end;end.
{$APPTYPE CONSOLE}
var
i,j,n,w : longint;
a : array[1..1000] of integer;procedure fact(k : longint);
var
x,i : longint;
begin
x := 0;
for i := 1 to w do
begin
a[i] := a[i]*k+x;
x := a[i] div 10;
a[i] := a[i] mod 10;
end;
while x>0 DO
begin
w := w+1;
a[w] := x mod 10;
x := x div 10;
end;
end;begin
a[1] := 1;
w := 1;
readln(n);
for i := 1 to n do fact(i);
for j := w downto 1 do write(a[j]);
end.
procedure TSDIAppForm.Button4Click(Sender: TObject);
Function NMN(i:Integer): Integer;
Begin
Result:= Ceil(Power(i,i));
End;
var
S, Temp: Int64;
I: Integer;
begin
S := 1; for I := 1 to 100 do
Begin
Temp := NMN(I);
S := S * Temp; if S >100000000 then
Begin
lblResult.Caption := FloatToStr(S / Temp);
Break;
End;
End;
end;lz是要求 1 到 N 的 N的N次方 相乘吗? 并且最终结果不大于 1000000000
如果是的话,这个代码你看结果是你要的吗