Hi everyone

I am new to java and am writing a program thats meant to have the following terminal output...

Enter a number: 29

29 is a prime number.

Enter a number: -7

Please enter a positive integer.

Enter a number: 45

45 is not a prime number.

Enter a number: 0

Exiting program...

I think there is meant to be four main structures to the program -

1. User enters number.

2. if number less than 0 then print "enter positive" and go back to 1

3. if number over 0 do following calculation - for(i=2; i <= number;

i--){ if number / i ==0 print not prime. else print prime

4. 1,2,3 keep repeating till 0 is pressed

I am not sure how to implement this into my program, linking it

together with the correct loops.

here is my current source code:

```
import java.io.*;
class PrimeChecker
{
public static void main(String[] args) throws IOException
{
BufferedReader stdin = new BufferedReader(new InputStreamReader (System.in));
int number = 1;
System.out.print("Enter a positive integer number: ");
number = Integer.parseInt(stdin.readLine());
do
{
if(number <= 0)
{
System.out.println("please enter a positive integer.");
}
else if(number > 0)
{
for(int i = 2; i <= number; i--)
{
if((number % i) == 0)
{
System.out.println("" + number + " is not a prime number");
}
else
{
System.out.println("" + number + " is a prime number");
}
}
}
}
while(number != 0);
}
}
```

Thanks for any help

Jonathan

*Edited 3 Years Ago by Dani*: Formatting fixed