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

 

jebbert@volusia.k12.fl.us > okraNumberAdvanced1
prev  |  next  |  chance

Write a method that returns the "okra number" of a given positive integer. Since the work "okra" has 4 letters in it, the "okra number" is based on the number 4. If the given number is a multiple of 4, just return double the value of the given number. However, if the given number is NOT a multiple of 4, return how much MORE it is than the next lower multiple of 4. For example, 11 is three more than the next lower multiple of 4 (which is 8), so okraNumberAdvanced1(11) returns 3. Note that 0 is considered a multiple of 4.


okraNumberAdvanced1(17) → 1
okraNumberAdvanced1(16) → 32
okraNumberAdvanced1(8) → 16

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

public int okraNumberAdvanced1(int 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: 270

Copyright Nick Parlante 2017 - privacy