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

 

orion.a.smith@gmail.com apcsa-loops > apcsaLoopsConcatInclusiveEvensAscending
prev  |  next  |  chance

Given two numbers a and b, build a String that contains every even (divisible by 2) number from a to b, inclusive. Precondition: a < b for all inputs.


HINT: Remember the % operator can be used to check whether a number is divisible by 2, as in (assuming someInt is an int):
someInt % 2 == 0 // divisible by 2

apcsaLoopsConcatInclusiveEvensAscending(3, 5) → "4"
apcsaLoopsConcatInclusiveEvensAscending(3, 10) → "46810"
apcsaLoopsConcatInclusiveEvensAscending(2, 4) → "24"

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

public String apcsaLoopsConcatInclusiveEvensAscending(int a, int b) { }

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

Copyright Nick Parlante 2017 - privacy