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

 

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

Write a method that accepts a 'base' indicating what base 'digits' are in. The array 'digits' contains the digits of a number in 'base'. Convert that number to decimal and return it. Preconditions: 2<=base<=10, 0<=digits[n]<base for each element in digits. Note: The resulting value in base 10 will be less than MAXINT.


test2023_01_19_HL_baseToDecimal(9, [2, 6, 1, 0, 4]) → 17581
test2023_01_19_HL_baseToDecimal(4, [3, 0, 0, 2, 0, 1]) → 3105
test2023_01_19_HL_baseToDecimal(8, [5]) → 5

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

public int test2023_01_19_HL_baseToDecimal(int base, int[] digits) { }

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: 290

Copyright Nick Parlante 2017 - privacy