0
Please explain 1 string c++.
How it works: if (num % 3 == 0)? https://code.sololearn.com/c9q6htkT7RZh/?ref=app
2 Réponses
+ 1
(num % 3) is the reminder of num after dividing by 3.
For example, 10 % 3 is 1, 12 % 3 is 0.
When num is a multiple of 3, the remainder would be 0.
The if statement checks if this is true, in which case it prints num. (null is probably a typo.)
So, basically, the while loop iterates over all numbers from 1 to 20 and if the number is a multiple of 3, prints it.
0
Thanks a lot, Im watching video right know and just understood)