Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
394 B
8
Indexable
Never
import java.util.Scanner;

public class prime{
	public static void main(String[] args){

	Scanner num = new Scanner(System.in);
	System.out.println("Enter the number : ");
	int number = num.nextInt();

	for(int i=2;i<number; i++){
		if (number%i==0){
			System.out.println(number+" is not a Prime Number.");
			System.exit(0);
			}
	}

	System.out.println(number+" is a Prime Number.");
	}
	
}
Leave a Comment