mercredi 8 novembre 2017

Random Number Generations

hey guys i have issue with random number generation in vb.net console application question starts 1)You have to generate numbers from 1 to 10 10 times (done) 2)store all 10 random number in to an array(1 D) (done) 3)calculate the sum the all random numbers in array (done) 4)check for every number from 1 to 10 how many times does it appears in array with out declaring too many variables (no advance programming simple logic) (Difficult) This is how i done it but the last part was not done by me need help in vb.net console application

Dim rnd As New Random Dim x(10) As Integer For i = 0 To 9 x(i) = rnd.Next(1, 10)

    Next

    For Each element In x
        Console.WriteLine(element)
    Next



    Console.ReadLine()

enter image description here

result is this so you have to tell how many time each number is repeated if not the print zero times number appear?????




Aucun commentaire:

Enregistrer un commentaire