Hacer un programa o algoritmo que calcule las 30 primeras potencias de 3 y la suma de ellos.
Codigo Fuente en Visual Basic
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sum As Double = 0 Dim cad As String = "" For i As Integer = 0 To 30 cad = cad + "3 potencia " + Trim(i) + " = " + Trim(Math.Pow(3, i)) & vbCrLf sum = sum + Math.Pow(3, i) Next i TextBox1.Text = cad TextBox2.Text = "suma total: " + Trim(sum) End Sub End Class
0 comentarios:
Publicar un comentario