CJCoding With Joseph
15free / daySign inCreate account

Count Multiples of 3 in a Range

Read two integers a and b (with a <= b) from standard input and print how many numbers in the range a to b (inclusive) are divisible by 3, with no trailing newline. For example, for the input 1 10 the multiples are 3, 6, and 9, so print the output shown in Expected Output.

Loop from a to b and count the values where i % 3 == 0.

Expected Output:

3

= newline. No newline after the last line.

Hints4 available
Topics:
Loops
📥 Auto-Input:
1 10
This input is automatically fed to your program's stdin
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.