โ Back to Loops
Question 220
Count Multiples of 3 in a Range
Count Multiples of 3 in a Range
Read two integersaandb(witha <= b) from standard input and print how many numbers in the rangeatob(inclusive) are divisible by3, with no trailing newline. For example, for the input1 10the multiples are3,6, and9, so print: 3 Loop fromatoband count the values wherei % 3 == 0.
Expected Output:
3
Topics:
Loops
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.