Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.
Random r = new Random();
int first = r.nextInt(9) + 1;
int second = r.nextInt(9) + 1;
while (second < first){
second = r.nextInt(9);
}
//answer
sum = first - second;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Random r = new Random();
int first = r.nextInt(9) + 1;
int second = r.nextInt(9) + 1;
if ( first < second )
{
int temp = first;
first=second;
second=temp;
}
//answer
sum = first - second;
sum /*[sic]*/ = Math.max(first,second)>second?first-second:second-first;
int first = r.nextInt(9) + 1;
int second = r.nextInt(Math.max(first - 1, 1)) + 1;
My whole point all along has been that first should ALWAYS be <= second.
rather than just getting a positive answer from two unknown numbers, undisplayed numbers
second = (int)(Math.random()*10);
first = Math.max(Integer.rotateRight(second,255),0);
I've got no idea whether you are speaking from a child's point of view, the programmer, or someone else., as you mentioned the game was for a child, but you didn't seem to grasp that.
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.