Diseñar un algoritmo que permita ingresar 5 números primos cualesquiera.
Codigo Fuente en Visual Basic
Public Class Form1 Dim d As Integer = 5 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click d = 5 Dim cad As String = "" Dim n As Integer Dim w As Integer n = TextBox1.Text If (n Mod 2 = 0) Then Else n = n - 1 End If While (d >= 1) w = n - (2 * d - 1) cad = cad + " " + Trim(w) d = d - 1 End While TextBox2.Text = cad End Sub End Class
No hay comentarios:
Publicar un comentario