-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrime.java
More file actions
32 lines (29 loc) · 800 Bytes
/
Prime.java
File metadata and controls
32 lines (29 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
/**
* Your goal is to take in a number and determine if it is prime.
*
* If you don't know what a prime number is:
* -->(https://en.wikipedia.org/wiki/Prime_number)<--
*
* Good luck!
*/
public class Prime {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter a number: ");
int num = scan.nextInt();
scan.close();
boolean isPrime = checkIfPrime(num);
if (isPrime) {
System.out.println(num + " is a prime number.");
} else {
System.out.println(num + " is not a prime number.");
}
}
public static boolean checkIfPrime(int num) {
/**
* Your code goes here!
*/
return true;
}
}