Code Challenge
Test yourself with a variety of coding challenges involving Arrays, Strings, loops, and more!
StartKey Concepts
Review core concepts you need to learn to master this subject
Loops identify divisble integers
Loops compute sums
Loops identify digits in a number
Loops determine a minimum or maximum value.
Loops determine the frequency with which a specific criterion is met
Loops can determine if at least one element has a particular property
Loops can determine if all elements have a particular property
Loops can determine the presence or absence of duplicate elements
Loops identify divisble integers
Loops identify divisble integers
int divisor = someNumber;
int dividend = anotherNumber;
while (dividend >= divisor) {
dividend -= divisor;
}
if (dividend == 0) {
// then the dividend is divisible by the divisor
}
Loops can be used to identify if an integer is or is not evenly divisible by another integer. By the end of the loop, if the dividend is 0, then we know that there are no leftovers and it is evenly divisible by the divisor.