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)
EditNota1: TEdit;
EditNota2: TEdit;
EditNota3: TEdit;
ButtonCalcular: TButton;
LabelResultado: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure ButtonCalcularClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ButtonCalcularClick(Sender: TObject);
var
Nota1, Nota2, Nota3, Media: Double;
begin
Nota1 := StrToFloat(EditNota1.Text);
Nota2 := StrToFloat(EditNota2.Text);
Nota3 := StrToFloat(EditNota3.Text);
Media := (Nota1 + Nota2 + Nota3) / 3;
LabelResultado.Caption := 'Média: ' + FormatFloat('0.00', Media);
end;
end.