program for prime number in java
Prime number is number which is divisible by 1 and itself.for example Number 7 is prime number because it is divisible by 1 and 7 only.whereas 8 is divisible by 1,2,4,8 therefore 8 is not prime number.
public static void main(String args)
DataInputStream in=new DataInputStream(System.in);
System.out.print(” Enter Number “);
prime_number = Integer.parseInt(in.readLine()); //input to check prime number
System.out.print(” The Number “+prime_number+” is “);
System.out.print(“Not a prime Number.”);
System.out.print(” Prime Number.”);
program for prime number in java OUTPUT:
Enter Number : 23
The Number 23 is Prime Number.