about | help | code help+videos | done | prefs |
Given two numbers a and b, build a String that contains every number from a to b, inclusive. Precondition: a < b for all inputs. Remember that String is not a primitive data type in Java, which means that you must use the capitalized word String to refer to it. Building a String means doing the following things: 1) Create a String object and assign it to the empty String, "".String output = "";2) When you have a number or numeric expression to concatenate (add to the end of) the existing String, use the + or += operators. Here are two examples: output = output + 5; //adds the character 5 to the end output += 5; //also adds the character 5 to the end apcsaLoopsConcatInclusiveAscending(1, 2) → "12" apcsaLoopsConcatInclusiveAscending(3, 5) → "345" apcsaLoopsConcatInclusiveAscending(1, 8) → "12345678" ...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: 210
Copyright Nick Parlante 2017 - privacy