Procedure Form1.Button1.OnClick(Sender: TObject);
var
nota1, nota2, nota3, nota4, nota5, nota6: Integer;
NumeroDeExamenes : Integer;
NotaPromedio : Double;
begin
If Edit1.Text <> '' then begin
NumeroDeExamenes := NumeroDeExamenes +1; Nota1 := StrToint(Edit1.Text); end;
If Edit2.Text <> '' then
begin
NumeroDeExamenes := NumeroDeExamenes +1;
Nota2 := StrToint(Edit2.Text);
end;
If Edit3.Text <> '' then
begin
NumeroDeExamenes := NumeroDeExamenes +1;
Nota3 := StrToint(Edit3.Text);
end;
If Edit4.Text <> '' then
begin
NumeroDeExamenes := NumeroDeExamenes +1;
Nota4 := StrToint(Edit4.Text);
end;
If Edit5.Text <> '' then
begin
NumeroDeExamenes := NumeroDeExamenes +1;
Nota5 := StrToint(Edit5.Text);
end;
If Edit6.Text <> '' then
begin
NumeroDeExamenes := NumeroDeExamenes +1;
Nota6 := StrToint(Edit6.Text);
end;
NotaPromedio := (Nota1 + Nota2 + Nota3 + Nota4 + Nota5 + Nota6) / NumeroDeExamenes
ShowMessage(FormatFloat('#0.0', NotaPromedio));
end;