id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

isPrime


A positive int n is prime if it has exactly two factors. Given int n, return true if n is prime, and false otherwise. Assume that n is a positive number.


isPrime(1) → false
isPrime(2) → true
isPrime(80) → false

...Save, Compile, Run (ctrl-enter)

boolean isPrime(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy