← Back to Loops
Question 290
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 the output shown in Expected Output. Loop fromatoband count the values wherei % 3 == 0.
Expected Output:
3= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics:
Loops
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.