GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — java-coding-problems/src/PrimeNumberCheck.java at main · jfullstackdev/java-coding-problems Expand file tree/ Copy pathPrimeNumberCheck.javaMore file actions 30 lines (24 loc) · 483 Bytes / Copy pathPrimeNumberCheck.javaFile metadata and controls30 lines (24 loc) · 483 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 public class PrimeNumberCheck { public static void main(String[] args) { int n; n = 12; System.out.print("is "); System.out.print(n); System.out.print(" prime number ? "); System.out.println(isPrime(n)); } public static boolean isPrime(int n) { if (n == 0 || n == 1) { return false; } if (n == 2) { return true; } for (int i = 2; i <= n / 2; i++) { if (n % i == 0) { return false; } } return true; } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |