Veredito sobre a media final de um grupo de alunos (considerando REC)
Reflexão
Dadas as notas de P1, P2, T1, T2 de
N alunos de MAC0113, dizer se cada um deles passou, ficou de REC ou foi reprovado direto.
Sub VereditoComRec()
Dim quantAlunos, Linha As Integer
Dim P1, P2, T1, T2, Media As Double
quantAlunos = Cells(1,1)
Linha = 2
Do While (Linha <= quantAlunos+1)
P1 = Cells(Linha, 1)
P2 = Cells(Linha, 2)
T1 = Cells(Linha, 3)
T2 = Cells(Linha, 4)
Media = (sqr(P1*T1) + sqr(P2*T2))/2.0
Cells(Linha, 5) = Media
If (Media >= 5.0) Then
Cells(Linha, 6) = "passou"
ElseIf (Media >= 3.0) Then
Cells(Linha, 6) = "rec"
Else
Cells(Linha, 6) = "reprovado"
End If
Linha = Linha + 1
Loop
End Sub