about | help | code help+videos | done | prefs |
Write a method that returns an array of 32 integers. The first element in the array will always be a zero. The rest of the array will contain either 0 or 1 and will represent the binary number that represents the decimal value of 'num'. As a precondition, you may assume that 'num' is non-negative. Look at the test data for examples. quiz2024_02_20_SLHL_binary(8712) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0] quiz2024_02_20_SLHL_binary(98127) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1] quiz2024_02_20_SLHL_binary(32) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy