User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 402,618 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,271 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting

random numbers into an array

Join Date: Dec 2007
Location: Greece
Posts: 476
Reputation: javaAddict is on a distinguished road 
Rep Power: 1
Solved Threads: 49
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Posting Pro in Training

Re: random numbers into an array

  #2  
May 14th, 2008
Since the user inputs the size you can create the array:

int [][] array=new int[N][N];

Then use a for-loop to put numbers in the array.

As I noticed at your example the random numbers are from 1 to 9. Is that a requirement? Meaning do the numbers have to be from 1 to N*N?
I AM the 12th CYLON
Reply With Quote  
All times are GMT -4. The time now is 1:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC