Algoritmo Sub ejercicioxd
Enviado por paola3gc • 22 de Abril de 2020 • Apuntes • 299 Palabras (2 Páginas) • 107 Visitas
Sub ejercicioxd()
Dim N(500), FN(100) As Double
Dim PA, NP, VM, CN, CM, NOTA As Double
Dim R, LNOTA As String
N(500) = 0
FN(100) = 0
CM = 500
PA = 0
NP = 0
VM = 0
CN = 0
R = " "
LNOTA = " "
Do
CN = CN + 1
Do
N(CN) = Val(InputBox("Ingrese la nota: "))
If (N(CN) < 0 Or N(CN) > 100) Then
MsgBox ("Ingrese la nota correctamente")
End If
Loop Until ((N(CN) >= 0) And (N(CN) <= 100))
If (CN = CM) Then
MsgBox ("Ya no puede ingresar más registros")
Else
R = InputBox("¿Desea continuar?")
End If
Loop Until (R = "No" Or CN = CM)
For I = 1 To (CN)
NOTA = N(I)
FN(NOTA) = FN(NOTA) + 1
NP = NP + NOTA
If (NOTA > 60) Then
PA = PA + 1
End If
Next I
NP = NP / CN
PA = PA / CN
For I = 0 To 100
If (FN(I) > VM) Then
VM = FN(I)
End If
Next I
For I = 0 To 100
If (FN(I) = VM) Then
LNOTA = LNOTA & I & ","
End If
Next I
Cells(1, 1) = "Cantidad Maxima de notas"
Cells(2, 1) = "Nota promedio"
Cells(3, 1) = "Porcentaje de aprobados"
Cells(4, 1) = "Valor máximo"
Cells(5, 1) = "Listado de Notas más frecuentes"
Cells(1, 2) = CN
Cells(2, 2) = NP
Cells(3, 2) = PA
Cells(4, 2) = VM
Cells(5, 2) = LNOTA
End Sub
...