Codigo Vba- Desplegar Un Polinomio
Dim n, i As Integer
Dim strMsg As String
n = Val(InputBox("Dame el orden del polinomio:"))
strMsg = "P(x)= "
ReDim p(0 To n) As DoubleFor i = 0 To n Step 1
p(i) = Val(InputBox("Dame el Coeficiente de x^" & Str(i) & " :"))
Next i
For i = 0 To n Step 1
If (p(i) 0) Then'' exponente cero
If (i = 0) Then
strMsg = strMsg + Str(p(i))
Else
''exponentes que son uno
If(i = 1) Then
If (p(i) 1 And p(i) -1) Then
If (i < n And i 0) ThenIf (p(i) > 0) Then
strMsg = strMsg + " + " & Str(p(i)) & "x"Else
strMsg = strMsg + Str(p(i)) & "x"
End If
End IfIf (i = n) Then
If (p(i) > 0) Then
strMsg = strMsg + " + " & Str(p(n)) & "x"Else
strMsg = strMsg + Str(p(n)) & "x"
End IfEnd If
Else
If (p(i) = 1) Then
If (i < n And i 0)Then
strMsg = strMsg + "+ x"
End If
If (i = n) Then...
Regístrate para leer el documento completo.