Lista em Delphi de números pares até um valor informado pelo usuário.
Enviado: sábado mar 22, 2025 4:13 pm
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
EditLimite: TEdit;
ButtonGerar: TButton;
MemoResultado: TMemo;
Label1: TLabel;
procedure ButtonGerarClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ButtonGerarClick(Sender: TObject);
var
Limite, i: Integer;
begin
Limite := StrToInt(EditLimite.Text);
MemoResultado.Lines.Clear;
for i := 2 to Limite do
if i mod 2 = 0 then
MemoResultado.Lines.Add(IntToStr(i));
end;
end.
=================================================================
https://www.nasciweb.com.br
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
EditLimite: TEdit;
ButtonGerar: TButton;
MemoResultado: TMemo;
Label1: TLabel;
procedure ButtonGerarClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ButtonGerarClick(Sender: TObject);
var
Limite, i: Integer;
begin
Limite := StrToInt(EditLimite.Text);
MemoResultado.Lines.Clear;
for i := 2 to Limite do
if i mod 2 = 0 then
MemoResultado.Lines.Add(IntToStr(i));
end;
end.
=================================================================
https://www.nasciweb.com.br