anonymous
  • anonymous
prime_count = 1 start_number = 2 number_to_check = 2 while prime_count <= 1000: result = number_to_check % start_number if result > 0: start_number +=1 elif result == 0: if start_number == number_to_check: print(number_to_check) number_to_check +=1 prime_count +=1 start_number =2 else: number_to_check +=1 start_number = 2 how can i modify this code to end at 1000?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
ur first control statement must be a for loop instead of while loop for (int i=1;i<=1000;i++)
anonymous
  • anonymous
You don't necessarily need to make it a for-loop.
anonymous
  • anonymous
Hi! I tried this code. It worked well. It stopped at 1000th prime number which is 7919.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
are you answered?

Looking for something else?

Not the answer you are looking for? Search for more explanations.