Friday, April 7, 2017

Random Number: Program code ( visual basic )

Computer Science(9608) notes and Resources






Program that randomly generates number from 1 to 100 both inclusive. 




Module Module1

    Sub Main()
        Randomize()
        Dim Temp As Integer
        For i = 1 To 4
            Temp = Int(Rnd() * 100) + 1
            Console.WriteLine(Temp)
        Next
        Console.ReadLine()
    End Sub

End Module





Module Module1

    Sub Main()

        Dim temp As New Random
        Dim num As Integer
        For counter = 1 To 50
            num = temp.Next(1, 101)
            Console.WriteLine(num)
        Next
        Console.ReadLine()
    End Sub

End Module





No comments:

Post a Comment

Comments here....