0
Create a for loop that iterates up to 50 while outputting "hello" at multiples of 4, "world" at multiples of 6 and "hello world"
how to do this
1 Answer
+ 3
To check for multiples use the modulo operator %. Modulo calculates the remainder of a division. If the number is an exact multiple then the remainder is zero, and the result of modulo is zero.
if (a%b==0) //then a is a multiple of b.