/* Write a program to Find whether number is Prime or Not. */
class PrimeNumber{
public static void main(String args[]){
int number = Integer.parseInt(args[0]);
int flag=0; for(int i=2;i
if(number%i==0)
{
System.out.println(number+" is not a Prime Number");
flag = 1;
break;
}
}
if(flag==0)
System.out.println(number+" is a Prime Number");
}
}
OTHER RESOURCES:
Check this program in my new website
C Program to find prime numbers in a given range
1 comments:
Please give program for number a is prime number means just print if its not a prime number means just print before prime number.
Post a Comment