check if the no. is prime no. in java..
Answers
Answered by
1
class no.
{
public static void main [ String arg()]
{
int i,n,c=0;
n= sc.nextInt();
for ( i=1;i<n;i++)
{
if(n%i==0)
c++;
}
if(c==2)
Sopln ("prime");
else
Sopln ("Invalid");
}
}
Similar questions
English,
3 months ago
Computer Science,
3 months ago
English,
3 months ago
Math,
7 months ago
English,
7 months ago