Write a program that prompts the user to input a positive ineteger. It should then output a message indicating whether the number is prime number. Note: 2 is the only even number that is prime. An odd integer is prime if it is not divisible by an odd integer less than or equal to the square root of the number.
Update:
This is my program its not done really still figuring it out :(
import java.util.*;
public class prime {
static Scanner kb = new Scanner(System.in);
public static void main() {
System.out.print("\fEnter positive integer:");
int num = kb.nextInt();
if (num < 1)
System.out.print("Please enter number greater than 1"
+ "Perform the program again");
else if (num == 2)
System.out.print("its a prime yey!");
else if (num % 2 == 0)
System.out.print("its not a prime ");
}
}
Idk whats next still figuring it out T.T