Advertisement
wadkat

java prime or not

Nov 15th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class ls {
  3. public static void main(String[]args){
  4. Scanner kb = new Scanner(System.in);
  5.  
  6. int num1;
  7. System.out.print("enter a number : ");
  8. num1 = kb.nextInt();
  9.  
  10. if(num1%2==0){
  11. System.out.print("the number is not a prime number\n");
  12.  
  13. }
  14. else if(num1%3==0){
  15. System.out.print(" number is not a prime number\n");
  16.  
  17. }
  18. else {
  19. System.out.print("the number is a prime number\n");
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement