about | help | code help+videos | done | prefs |
incrementTillEqual
Write a function incrementTillEqual(a,b) which takes two integer parameters, determines which is larger, and uses a while loop to increment the smaller until they are equal. Use a counter which starts at 0 to keep track of how many times the while loop runs and return the counter at the end. incrementTillEqual(1, 2) → 1 incrementTillEqual(6, -42) → 48 incrementTillEqual(1012, 55) → 957 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy