[JAVA] Need help with a program, it's not working [SOLVED]


Recommended Posts

I tried running it on my machine and was getting huge numbers:

atlo: 1410065128
141000%

I realized it's because your 

if(prize >= 1){
	atlo++;
}

is inside the for loop which runs a million times, thus for the first time in any lottery that n = 500 alto increases for every value of i after that up to a million.

I changed a few things around and got more realistic values, but certain they're still incorrect.

I don't have any more time at the moment to work on it, here's my code:Screenshot (371).png

 

  • Like 1
Link to post
Share on other sites
On 6/8/2017 at 10:11 AM, FOX545 said:

I tried running it on my machine and was getting huge numbers:

atlo: 1410065128
141000%

I realized it's because your 


if(prize >= 1){
	atlo++;
}

is inside the for loop which runs a million times, thus for the first time in any lottery that n = 500 alto increases for every value of i after that up to a million.

I changed a few things around and got more realistic values, but certain they're still incorrect.

I don't have any more time at the moment to work on it, here's my code:Screenshot (371).png

 

What makes you think the answer is still incorrect? (Have you calculated it manually? :P ) 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.