Somar dois números

Responder
Anthonymug
Mensagens: 1
Registado: quinta abr 03, 2025 4:57 am

Somar dois números

Mensagem por Anthonymug »

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)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
public
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
N1, N2, Resultado: Double;
begin
N1 := StrToFloat(Edit1.Text);
N2 := StrToFloat(Edit2.Text);
Resultado := N1 + N2;

ShowMessage('Resultado: ' + FloatToStr(Resultado));
end;

end.



https://www.nasciweb.com.br
Responder