Prime Number Program in Java
class Prime
{
public staic void main(String[]args)
{
// intializede variable
int primeNumber=10;
// ldata strore and hold for using that variable
int temp=0;
for(int i=2;i<primeNumber-1;i++)
{
if(primeNumber%i==0)
{
temp=temp+i;
}
if(temp==0)
{
System.out.println("this not prime Number");
}
else{
System.out.println("this is prime Number");
}
}
}
}
0 comments:
Post a Comment