Chapter 7 Challenge


#1

Will someone explain to me what this statement (i % 5 == 0) literally translates into? I was using (i % 5) in my “if statement” previously, however my output frustratingly kept stopping at 95. After seeing some of the solutions here in the forum, I incorporated the == operator and it worked. While it makes intuitive sense, I would still like to know exactly what it means in this particular code’s context. Thanks in advance!

  • Professah

#2

(i % 5 == 0) means the value of i is divisible by 5 without any remainder; that is, i is an integral multiple of 5: i = k * 5, k is an integer.


#3

Thanks!