Question

# A prime number is an integer greater than 1 that is evenly divisible by only 1...

A prime number is an integer greater than 1 that is evenly divisible by only 1 and itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are not. Create a PrimeNumber application that prompts the user for a number and then displays a message indicating whether the number is prime or not. Hint: The % operator can be used to determine if one number is evenly divisible by another. ( Java programing )

```//PrimeNumberCheck.java
import java.util.Scanner;
private static boolean isPrime(int n) {
if(n%2!=0 && n%3!=0){
return true;
}
else{
return false;
}
}

public static void main(String args[]) {
int n;
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
n = scanner.nextInt();
if(isPrime(n)){
System.out.println(n+" is a prime");
}
else{
System.out.println(n+" is a not prime");
}
}
}
```

#### Earn Coins

Coins can be redeemed for fabulous gifts.

##### Need Online Homework Help?

Most questions answered within 1 hours.

##### Active Questions
• Consider the following system of linear equations: 2x1−2x2+4x3 = −10 x1+x2−2x3 = 5 −2x1+x3 = −2...
• The following command has been successfully executed: Create Sequence EmpSeq; The following block of PL/SQL code...
• You own a mid-size company that designs 3-D imaging products. The government has requested you to...
• J owns an 80% interest in the capital and profits of the JL partnership. On April...
• For the population of infants subjected to fetal surgery for congenital anomalies, the distribution of gestational...
• Bill needs to schedule a meeting for tomorrow afternoon, but he also has a tee time...