CJCoding With Joseph

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:

3

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

Expected Output:

3
Topics:
Loops
๐Ÿ“ฅ Auto-Input:
1 10
This input is automatically fed to your program's stdin
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.