Kamis, 31 Juli 2025

VB HitungJmlhBilangan

 Module HitungJmlhBilangan

    'Buka HitungJmlhBilangan.vproj

    Sub Main()

        Dim i As Integer, x As Integer, hasil As Integer

        hasil = 0

        x = InputBox("Masuk jumlah bilangan: ")

        For i = 1 To x

            hasil = hasil + i

            If (i <> x) Then

                Debug.Print(i & " + " & vbNullChar)

            Else

                Debug.Print(i & " = " & vbNullChar)

            End If

        Next i

        Debug.Print(hasil)

    End Sub

End Module


Tidak ada komentar: