📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Panel1: TPanel;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Label4: TLabel;
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormClick(Sender: TObject);
var
x,y,m,n,i,j,k:integer;
p,q:real;
s:string;
begin
if edit1.Text='' then edit1.Text:='6';
n:=strtoint(edit1.Text);
x:=0;y:=0;i:=2;j:=2;
for i:=1 to n do
begin
m:=n-i;
p:=strtofloat(inttostr(i));
q:=strtofloat(inttostr(m));
while(j<=sqrt(p))and(x=0)do
if i mod j=0 then x:=1;
while(k<=sqrt(q))and(y=0)do
if m mod k=0 then y:=1;
if (x=0)and(y=0)then
label3.Caption:=edit1.Text+'='+inttostr(i)+'+'+inttostr(m);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -