about | help | code help+videos | done | prefs |
apcsaLoopsAddInclusiveEitherWay
Given two ints a and b, add all the numbers between a and b, inclusive. So if a is 4 and b is 7, the result should be 22, the result of 4+5+6+7. For all inputs, a < b is NOT a precondition (either a or b could be larger). However, a != b IS a precondition. HINTYou should probably determine which of a and b is larger first. apcsaLoopsAddInclusiveEitherWay(4, 7) → 22 apcsaLoopsAddInclusiveEitherWay(8, 5) → 26 apcsaLoopsAddInclusiveEitherWay(-10, -4) → -49 ...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: 150
Copyright Nick Parlante 2017 - privacy