Hello everyone,
I wanted to writte a program to print prime numbers between two given numbers.
The range of numbers should be given through command prompt.
like if we give
First of all, please add some indentation. It's not easy to read this way.
Your flag will remain false if it even one number is not a prime, because the only place you set it to true is at the very start of the method. You should set it to true for each number you want to test; just move the declaration inside the first for-loop.