But condition is numbers should generate automaticall[i.e in above example 3,4,0,1,2 shouls generate automatically]
please reply
I didn't give you the whole thing. You need to generate b[] randomly using a random number generator that generates numbers from 0 to 4. You'll need code that checks to assure no duplicates occur when generating those numbers. Easiest way is to set up a loop, generate a random number, then check to see if that random number has occurred before. If not, keep it and store it in b[], then increment the loop counter. If it is a duplicate, don't increment the loop counter, discard the duplicate number, generate another random number, and test again for duplicates. Give it a try and post your attempt.
Reputation Points: 2614
Solved Threads: 687
Posting Expert
Offline 5,371 posts
since Jan 2008