Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

making mistake

 
fozia inam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,i have done the mistake sorry for it.
my problem is that i have to this assignment in java.lang
and ihave written acode but the output is not correct.the code is:

plz tell me where i m making mistake
(edited by Cindy to format "for" loop)

[This message has been edited by Cindy Glass (edited November 28, 2001).]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this thread continues from this one.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i understand, you want an array of 20 random integers?
Obviously from your code there are other requirements (such as the range of the numbers and that they are unique)
Can you spell out the requirements for us and we can point out where you are going wrong.
Dave.
 
Murtuza Thaver
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might help
<code>
int a[]=new int[20];
for(int i=0;i<20;i++) {
//a[i]=(int)((Math.random()*11)+55);
//I was not sure what range u intended
//for this range is 11 < value < 55
a[i]=11 + (int)(Math.random() *55);

//u need to remove this as this is going to be
//true all the time
//if(a[i]==a[i]){
//continue;
//}


System.out.print(" " + a[i]);
}
}
</code>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic