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

 

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

Write a method that converts the input parameter 'num' to a binary number and returns that binary number as a string. For example, in binary 18 is represented as 10010, so if you pass in 18 the method should return "10010". This can be done iteratively with a single loop or can be done recursively with no loops! However, if you need more than one loop that is OK. Also, recursion is NOT required. Look at the test data for further examples.


test2021_01_15_P1SLHL_toBinary(21847) → "101010101010111"
test2021_01_15_P1SLHL_toBinary(129802) → "11111101100001010"
test2021_01_15_P1SLHL_toBinary(11) → "1011"

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

public String test2021_01_15_P1SLHL_toBinary(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: 220

Copyright Nick Parlante 2017 - privacy