Hello, this is a loop I've written to find all the prime numbers up to the input from the user (n)

I can see that this one has many steps to perform and so I am looking for a way to improve it's efficency.

for(int m = 2; m < n; m++) { boolean isPrime = true; for (int c = 2; c < m; c++){ if(m%c == 0) isPrime = false; //is not a prime } if(isPrime == true) { System.out.println(m); } }

I'd really like to use 'break' somewhere, somehow.

Could you please help me, or give me a few tips?

Thank you for your time and knowledge