Computer Science, asked by mistibanerjee69, 7 months ago

check if the no. is prime no. in java..​

Answers

Answered by Munmun57
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