**Prime Number Program:**

Prime number is a number that is divided by 1 or itself and greater than 1 . In other words, prime numbers can’t be divided by 1 (or) other numbers than itself. For example 2, 3, 5, 7, 11, 13, 17,19,23,29…. etc. are the

prime numbers.import java.util.Scanner; public class primenumber {

public static void main(String args[]) {

int n, count=0; System.out.println(“enter the n value ;”);

Scanner s=new Scanner(System.in);

n=s.nextInt(); for(int i=1;i<=n;i++) { if(n%i==0) { count++; } } if(count<=2) { System.out.println(“the given number is prime number”);

}

else { System.out.println(“the given not number isprime number”);

} }

output:

enter n value: 4 The given number is not a prime number

**Related Programs Below:**

Write a program the given number is even or odd in java?

Write a program for the given number is Fibonacci or not in java?

Prime numbers in Java?

Palindrome number Program in java?

Armstrong Number or not in Java?

Write a program for the given number is strong Number or Not in java?

Write a program swapping two numbers without using third variable in java ?

Swapping of two numbers using third variable in java?