Program to check number is prime or not in java

import java.util.Scanner;
public class PrimeNumberOrNot {
 public static void main(String[] args) {
 int c =0;
 Scanner in = new Scanner(System.in); //scanner for input
 System.out.print("Enter number : ");
 int n = in.nextInt();
 for(int i=2; i <= (n/2); i++) {
  if((n % i) == 0){
   c++;
   break;
  }
 }
 if((c==0) && (n!= 1)){
  System.out.println( n + " prime number.");
 }
 else {
  System.out.println( n+ " not a prime number.");
 }
 }
}