Take Input From User And Check If Its Prime Or NOT
class prime // By Steve
{
public static void main(int a)
{
int b=0;
for (int i=2;i<a;i++)
if(a%i==0)
b+=1;
else
b=b;
if(b<1)
System.out.println(a+" Is a Prime Number");
else
System.out.println(a+" Is NOT a Prime Number");
}
}
Input: 99, 23,1.
Output :
No comments:
Post a Comment