class Prime_number {
public static void main(String[] args) {
int num = 11;
int i;
for (i=2; i < num ;i++ ){
int n = num%i;
if (n==0){
System.out.println("not Prime!");
break;
}
}
if(i == num){
System.out.println("Prime number!");
}
}
}
Search Java Programs
Showing posts with label Find-out-the-prime-number. Show all posts
Showing posts with label Find-out-the-prime-number. Show all posts
Tuesday, January 19, 2010
Find out the prime number
Here is the code program:
Subscribe to:
Posts (Atom)