primeno.java
class primeno
{
public static void main(String args[])
{
int no=17,flag=0;
int m=no/2;
for(int i=2;i<=m;i++)
{
if(no%i==0)
{
System.out.println("This Number is not Prime");
flag=1;
break;
}
}
if(flag==0)
{
System.out.println("This number is Prime");
}
}
}
class primeno
{
public static void main(String args[])
{
int no=17,flag=0;
int m=no/2;
for(int i=2;i<=m;i++)
{
if(no%i==0)
{
System.out.println("This Number is not Prime");
flag=1;
break;
}
}
if(flag==0)
{
System.out.println("This number is Prime");
}
}
}
No comments:
Post a Comment