- 1
Find prime number
2 Respostas
- 1
import java.util.Scanner;
public class primenumber{
public static void main(String[] args) {
int a;
Scanner k=new Scanner (System.in);
a=k.nextInt();
if((a==2)||(a==3)||(a==5)||(a==7))
System.out.print("this is prime number");
if ((a%2==0)||(a%3==0)||(a%4==0)||(a%5==0)||(a%6==0)||(a%7==0)||(a%8==0)||(a%9==0))
{System.out.print("this not prime num");}
else if ((a/a==1) && (a/1==a))
{System.out.print("this is prime number");}
}
}