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

 

gaurav.gupta@mq.edu.au loops > nearlyPrime
prev  |  next  |  chance

First, solve the problem at https://codingbat.com/prob/p201853 and then come to this one.

A number is called "nearly-prime" if besides, 1 and itself, it's divisible by exactly one other integer.

Define a function that when passed an integer, returns true if it is nearly-prime, false otherwise.


nearlyPrime(77) → false
nearlyPrime(32) → false
nearlyPrime(62710561) → true

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

boolean nearlyPrime(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: 3 Post-solution available

Copyright Nick Parlante 2017 - privacy