ANSWERS: 4
  • Sorry. I'm not in school, nor is it in my job description. YOU do it.
  • No thanks. Besides, if it's just between 1 and 50, you could probably do it faster just using your brain. There aren't that many prime numbers between 1 and 50
  • main() { cout << "all the prime numbers between 1 and 50."; } Do I win? ;-) Seriously, just loop from 2 to 50 and make an inner loop starts at 2 and goes up to the square root of the outer loop's count, and checks to see if that inner loop's variable will divide evenly into the outer loops variable. If it does, it's not a prime, and you can move on to the next outer loop count. Have fun.
  • https://pastebin.com/a5G8xXt9 The code is in the link above

Copyright 2018, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy