VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 4905 ClientLeft = 60 ClientTop = 420 ClientWidth = 7770 LinkTopic = "Form1" ScaleHeight = 4905 ScaleWidth = 7770 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdesci Caption = "&Esci" Height = 495 Left = 4200 TabIndex = 3 Top = 2880 Width = 2415 End Begin VB.CommandButton cmdCalcola Caption = "&Calcola" Height = 495 Left = 480 TabIndex = 2 Top = 2880 Width = 2295 End Begin VB.TextBox TxtNumero Height = 405 Left = 2280 TabIndex = 0 Top = 240 Width = 4335 End Begin VB.Label Label1 Caption = "inserire un numero intero positivo" Height = 495 Left = 120 TabIndex = 5 Top = 240 Width = 1935 End Begin VB.Label LblRisultato Height = 375 Left = 3360 TabIndex = 4 Top = 1200 Width = 3495 End Begin VB.Label Label2 Caption = "Il più grande numero naturale per cui è divisibile è" Height = 495 Left = 240 TabIndex = 1 Top = 1200 Width = 2535 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Cmdcalcola_Click() Dim Contatore, Divisore As Integer Dim Numero As Double Numero = Val(TxtNumero.Text) If Numero > 0 Then If Numero = Int(Numero) Then Divisore = Numero For Contatore = (Numero - 1) To 1 Step -1 If (Numero Mod Contatore) = 0 Then Divisore = Contatore Exit For End If Next Contatore LblRisultato.Caption = Divisore Else IblRisultato.Caption = "il numero non è intero" End If Else LblRisultato.Caption = "il numero è negativo o nullo" End If End Sub Private Sub cmdesci_Click() End End Sub