I have an assignment on loops which i pretty much suck at i need help aah D:
The question is *cough cough*:
2. (Prime Numbers)
Write a program that prompts the user to input 2 integer numbers specifying a range (say n and m). Your
program shall print out all prime numbers in the range [n : m]. The program should display a message in this
respect (see output).
Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd integer less
than the number.
could u help me with i should write the code and if possible a little explaination
I am not trying to be rude here, but Google is your best friend. There have been hundreds of topics about prime numbers on this site. And Millions elsewhere.
Although don't fall into the trap of dividing by every number before N. It's better to have a container of all the numbers, then remove multiples of 2, the next number in the container is prime -start from that number squared and remove multiples of it (from 9 remove multiples of 3). Continue with the next number in the container (5).
Then it's easy to pull out a range of numbers from the container.
With help on loops look at the tutorial top left of this page. Reference and Article there too.