Prime number program in java
public class
PrimeNumber{
public static void main(String args[]){
int i,j=0,flag=0;
int number=11; //prime number
j=number/2;
for(i=2;i<=j;i++){
if(number%i==0){
System.out.println("This is not a prime
number");
flag=1;
break;
}
}
if(flag==0)
System.out.println("This is a prime
number");
}
}
Output:
This is a prime
number
EmoticonEmoticon