I'm so close to finishing this program. All need to do is output 2, 3, 5 because those are prime numbers as well(the only numbers left to output). How could I modify my code to output those numbers as well.
This won't find just prime numbers; for example, this program would print out 49 even though 49 isn't a prime number.
This is also the reason your code won't output 2, 3, and 5. When checking if the number is prime, instead of checking if it is divisible by 2, 3, and 5, you should use a for loop to go from 1 to the num/2 to ensure that the number is in fact prime. You should also have a boolean to see if its prime. You could make this another function or
you could put it inside the same function.