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

 

isPrime


Returns true if the number is prime, false otherwise. Primes are integers greater than one with no positive divisors besides one and itself. You will find modulus (%) and Math.sqrt() useful


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

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

public boolean isPrime(double num){ }

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: 180 Post-solution available

Copyright Nick Parlante 2017 - privacy